1.0.19 • Published 1 year ago

react-time-picker-next v1.0.19

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

react-time-picker-next

A simple time picker which supports both 12 and 24 hour formats.

This is a light weight and simple time picker which can be styled easily.

Install

npm install react-time-picker-next --save

Compatibility

Compatible with React versions ^16.0.0, ^17.0.0 and ^18.0.0.

Usage

1. Include Time Picker

Node:

import TimePicker from 'react-time-picker-next'

2. Add the custom component to the destination

<TimePicker
    format="12" // Either "12" or "24"
    value="18:30"
    onChange={(e) => {
        console.log(e); // output => {time: '06:30 PM', timeISO: '18:30'}
    }}
></TimePicker>

3. Handle and notify error situation

<TimePicker
    format="12" // Either "12" or "24"
    value=""
    error={{}} // Will highlight the input in red, {null} or remove the prop to revert
    onChange={(e) => {
        console.log(e); // output => {time: '06:30 PM', timeISO: '18:30'}
    }}
></TimePicker>

4. Add the browser time picker component to the destination (If you dont need cutom time picker)

<TimePicker
    useBrowserPicker={true} // This will enable the built in browser time picker(for already installed users)
    value="18:30"
    onChange={(e) => {
        console.log(e); // output => event param object
    }}
></TimePicker>

5. Open/close time picker menu on custom event

const [openMenu, setOpenMenu] = useState(false);

<TimePicker    
    openMenu={openMenu}
></TimePicker>

6. Style the component using these props You can provide additional styling using these props

disabled - Disables the component

containerClassName - Outermost container div.

inputClassName - Input textbox.

menuClassName - Container for the menu.

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago