🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-time-textfield

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-time-textfield

Material UI TextField with controlled hour/minute/meridiem input

1.0.9
latest
Source
npm
Version published
Weekly downloads
12
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

react

FAQs

Package last updated on 30 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts