A simple, yet customizable, React component for time selection.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.babelrc
.eslintrc.js
.gitattributes
.gitignore
.travis.yml
LICENSE.md
README.md
package-lock.json
package.json

README.md

react-input-time

npm Build Status Coverage Status

A simple, yet customizable, React component for time selection.

Install

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, value) => {

        }}
    />
);

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 the new value and the complete SyntheticEvent 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-input-time, but heavily stripped down.