time input for react applications
npm install @madappgang/time-inputSmart time input for react applications
``bash`
$ npm install @madappgang/time-input
You provide your own input representation using render props
`javascript
import TimeInput from '@madappgang/time-input';
...
this.state = {
time: { hours: 0, minutes: 0, prefix: 'am' }, // i/o time format
};
return (
onChange={time => this.setState({ time })} // { hours, minutes, prefix }
>
{({ value, onChange, onKeyDown, onBlur }) => (
value={value}
onChange={onChange}
onKeyDown={onKeyDown}
onBlur={onBlur}
/>
)}
);
``
| Prop | Type | Description |
|:----:|:----:|:-----------:|
| value | String | The intermediate input value |
| invalid | Bool | The input value validity indicator |
| onChange | Func | Input value change event handler |
| onKeyDown | Func | Input value keyDown event handler |
| onBlur | Func | Input value blur event handler |