An open API service indexing awesome lists of open source software.

https://github.com/patrick-s-young/react-time-textfield

A controlled Material-UI TextField for keyboard time input.
https://github.com/patrick-s-young/react-time-textfield

material-ui react textfield-validation time

Last synced: 3 months ago
JSON representation

A controlled Material-UI TextField for keyboard time input.

Awesome Lists containing this project

README

        

# React-Time-TextField

A controlled Material-UI TextField for keyboard time input.

![react-time-textfield-demo](https://user-images.githubusercontent.com/42591798/219899124-abe75346-f33a-4371-8d22-34c729d31ecf.gif)

## 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 ``. 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:

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

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

return (

);
}
```

### Custom styling

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

```

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](https://github.com/patrick-s-young)