1.0.8 • Published 5 years ago

@dprovodnikov/time-input v1.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

React time input

Smart time input for react applications

Example

Installation

$ npm install @dprovodnikov/time-input

Usage example

You provide your own input representation using render props

import TimeInput from '@dprovodnikov/time-input';

...

this.state = {
  time: { hours: 0, minutes: 0, prefix: 'am' }, // i/o time format
};

return (
  <TimeInput
    time={this.state.time}
    onChange={time => this.setState({ time })} // { hours, minutes, prefix }
  >
    {({ value, onChange, onKeyDown, onBlur }) => (
      <input
        value={value}
        onChange={onChange}
        onKeyDown={onKeyDown}
        onBlur={onBlur}
      />
    )}
  </TimeInput>
);

Available props

PropTypeDescription
valueStringThe intermediate input value
invalidBoolThe input value validity indicator
onChangeFuncInput value change event handler
onKeyDownFuncInput value keyDown event handler
onBlurFuncInput value blur event handler

License

MIT

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago