1.0.19 • Published 12 months ago

react-time-picker-next v1.0.19

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months 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

12 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.15

12 months ago

1.0.14

12 months ago

1.0.13

12 months ago

1.0.12

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago