React time picker dropdown.

A simple & user-friendly Time picker component for your react app.

Try it out

01
02
03
04
05
06
07
08
09
10
11
12
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
am
pm
<TimePicker
defaultValue="10 : 00: 00 am"
placeholder="hh : mm : ss a"
useTwelveHourFormat={true}
showClockIcon={true}
showCloseIcon={true}
allowBackdrop={true}
/>

Installation

Text Copied.
npm i @ashwinthomas/react-time-picker-dropdown

Usage

Learn how to integrate the TimePicker component into your React applications seamlessly!

Text Copied.
importTimePickerfrom"@ashwinthomas/react-time-picker-dropdown";
return(
<TimePicker
defaultValue="10:00:00"
onTimeChange={handleTimeChange}
/>
)

You can import the TimePicker from @ashwinthomas/react-time-picker-dropdown. Currently appearance customizisation using props is limited to clock and close icon visibility, however you can use the timepicker class names to change the default appearance. Time selection using the timepicker component can also be done using a keyboard by making use of the arrowkeys and enter key, and an esc key can be used to close the dropdown.

Props

Prop nameDescriptionDefault valueExample values
defaultValueSets default input value supports formats hh:mm:ss a and hh:mm:ssnull"10:10:00 am"
placeholderCan be used to set input placeholder"00 : 00 : 00""hh : mm : ss"
useTwelveHourFormatUse useTwelveHourFormat props to switch between 24 / 12 hour formatfalsetrue
onTimeChangeFunction called when user picks a time. (Returns null if the input value is invalid.)n/a(value)=>alert("Time selected is: ", value)
onInputChangeFunction called when picker value changed using the dropdownn/a(value)=>alert("Display time changed: ", value)
showCloseIconshowCloseIcon can be used to toggle close icon visibilitytruetrue
showClockIconshowClockIcon can be used to toggle clock icon visibilitytruetrue
allowBackdropallowBackdrop can be used to toggle backdropfalsefalse