0.3.3 • Published 8 months ago

next-ios-time-picker v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

npm downloads

React ios time picker

React-ios-time-picker demo

A modern time picker for your next React app.

  • No moment.js needed
  • Zero dependencies and lightweight

install

npm install react-ios-time-picker

Usage

24 hours format

24 hours format

import React, { useState } from 'react';
import { TimePicker } from 'react-ios-time-picker';

export default const  MyApp = () => {
   const [value, setValue] = useState('10:00');

   const onChange = (timeValue) => {
      setValue(timeValue);
   }

   return (
      <div>
         <TimePicker onChange={onChange} value={value} />
      </div>
   );
}

12 hours format

12 hours format

import React, { useState } from 'react';
import { TimePicker } from 'react-ios-time-picker';

export default const  MyApp = () => {
   const [value, setValue] = useState('10:00 AM');

   const onChange = (timeValue) => {
      setValue(timeValue);
   }

   return (
      <div>
         <TimePicker onChange={onChange} value={value} use12Hours/>
      </div>
   );
}

API

NameTypeDefaultDescription
valueStringn/aCurrent value.
cellHeightNumber35The height of the cell number.
placeHolderString"Selet_time"Time input's placeholder.
pickerDefaultValueString"00:00"The initial value that the picker begin with in the first time.
disabledBooleanfalseWhether picker is disabled.
isOpenBooleanfalseWhether the time picker should be opened.
requiredBooleanfalseWhether time input should be required.
cancelButtonTextString"Cancel"Cancel button text content
saveButtonTextString"Save"Save button text content
controllersBooleantrueWhether the buttons should be displayed
seperatorBooleantruewhether show the colon seperator
idStringn/aInput time picker id
nameStringn/aInput time picker name
use12HoursBooleanfalse12 hours display mode
inputClassNameStringn/aInput time picker className
popupClassNameStringn/atime picker popup className
onChange(value) => alert ('New time is: ', value)n/aCalled when select a different value
onSave(value) => alert ('Time saved is: ', value)n/aWhen the user clicks on save button
onClose() => alert('Clock closed')n/aWhen the user clicks on cancel button
onAmPmChange(value) => alert('Am/Pm changed : value')n/acalled when select an am/pm value
onOpen() => alert('time picker opened')n/acalled when time picker is opened

Contributions Welcome!

git clone https://github.com/MEddarhri/react-ios-time-picker
cd react-ios-time-picker

License

The MIT License.

0.3.3

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.8

8 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.5

8 months ago

0.2.4

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago