react-time-picker-roll
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

npm downloads NPM Downloads

React time picker roll

A Simple time picker roll for React or Next app.

install


npm install react-time-picker-roll

Usage

import React, { useState } from 'react';
import { TimePickerComponent } from 'my-time-picker';


export default const  MyApp = () => {
  // initialTime
   const [value, setValue] = useState({ hours: 6, minutes: 0, period: 'AM' });

  // onChange
    const handleTimeChange = (time: {
      hours: number;
      minutes: number;
      period: string;
    }) => {
      console.log(time);
      setValue(time)
    };


   return (
      <div>
        <TimePickerComponent
          initialTime={value}
          onChange={handleTimeChange} />

       <p>Selected Time: {value} </p>
      </div>
   );
}

API

Name Type Default Description
value String n/a Current value.
name String n/a Input time picker name
onChange (value) => alert('New time is:', value) n/a Called when select a different value

License

The MIT License.

Package Sidebar

Install

npm i react-time-picker-roll

Weekly Downloads

24

Version

0.1.5

License

MIT

Unpacked Size

102 kB

Total Files

12

Last publish

Collaborators

  • metwally98