0.1.5 • Published 6 months ago

react-time-picker-roll v0.1.5

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

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

NameTypeDefaultDescription
valueStringn/aCurrent value.
nameStringn/aInput time picker name
onChange(value) => alert('New time is:', value)n/aCalled when select a different value

License

The MIT License.