1.0.9 • Published 8 months ago

react-time-textfield v1.0.9

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

React-Time-TextField

A controlled Material-UI TextField for keyboard time input.

react-time-textfield-demo

Quick Start

  • Install by executing npm install react-time-textfield or yarn add react-time-textfield.
  • Import by adding import { ReactTimeTextField } from 'react-time-textfield'.
  • Use by adding <ReactTimeTextField />. Assign callback to onBlur prop to receive new value.
  • Hours/Minutes/Meridiem can be input using both keyboard and up/down arrows. Use Tab and right/left arrows to navigate.

Getting started

Installation

Add React-Time-TextField to your project by executing npm install react-time-textfield or yarn add react-time-textfield.

Usage

Here is an example of basic usage:

import React, { useState } from 'react';
import { ReactTimeTextField } from 'react-time-textfield';

function MyApp() {
  const [value, setValue] = useState(new Date());

  return (
   <ReactTimeTextField
    value={value}
    label='Start Time'
    onBlur={setValue}
   />
  );
}

Custom styling

ReactTimeTextField uses Material-UI TextField. Just pass any styling-related props that the Mui TextField component uses and they will be applied:

 <ReactTimeTextField
  value={value}
  label='Start Time'
  onBlur={setValue}
  size='large'
  styles={{ width: '100px', height: '60px' }}
 />

NOTE: onChange, onKeyDown, and onClick props are used internally and are not available. Use onBlur callback to receive date object with specified time value.

License

The MIT License.

Author

Patrick S. Young

1.0.9

8 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago