react-input-time
v3.0.0
Published
A simple, yet customizable, React component for time selection.
Downloads
238
Readme
react-input-time
A simple, yet customizable, React component for time selection.
Install
Requires React 16.8 or later
npm install --save react-input-time
or
yarn add react-input-time
Usage
import React from 'react';
import ReactDOM from 'react-dom';
import TimeInput from 'react-input-time';
const App = () => (
<TimeInput
className="input-time"
initialTime="13:37"
onChange={(event) => {}}
/>
);
ReactDOM.render(<App />, document.querySelector('.app'));
Options
initialTime
: The initial time value, required.input
: A custom<input>
element to use instead of the default one.onChange
: onChange handler, will be passed a completeSyntheticEvent
object.
All other props will be passed straight through to the rendered DOM element.
Acknowledgments
Originally based on logic from https://github.com/dima-bu/react-time-input, but heavily stripped down.