Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-time-picker-input

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-time-picker-input

Simple react imte picker input

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
890
decreased by-0.89%
Maintainers
1
Weekly downloads
 
Created
Source

React-Time-Picker-Input

Simple and light time picker for React app. No moment.js needed

Installation

npm install react-time-picker-input
yarn add react-time-picker-input

Import Component

import TimePicker from 'react-time-picker-input'

Import Styles

import "react-time-picker-input/dist/components/TimeInput.css"

Demo

See Demo

Usage

Here's an example of basic usage:

import React, { useState } from 'react';
import TimePicker from 'react-time-picker-input';

function TimePickerTest() {
const [value, setValue] = useState('10:00');

    return (
        <div>
            <TimePicker
                onChange={(newValue)=>setValue(value)}
                value={value}
            />
        </div>
    );

}

Props

PropNameTypedefaultdescription
onChangefunction(date)=>{}It fires every time that time is valid (minute hour exists) and returns date parameter which is date in string 24 hour format
onChangeEveryFormatfunction(date)=>{}Similar to onChange but it can be used when allowDelete is true to get every value no matter if it is valid
valueString"- -"Defines default value of TimePicker. Required format ("HH:mm") ex("22:04") -> always 24Hour format
hour12Formatbooleanfalsemake it true to make input 12HourFormat support see on demo example
allowDeletebooleanfalsemake it true if you want to allow user to delete fields (hour and minutes) using Backspace
disabledbooleanfalsemake it true if you want to block user editting (no change on input can happen and cursor is turned to disabled)
eachInputDropdownbooleanfalsemake it true if you want to activate drodpown for each input (default is automatically not manually managed)
manuallyDisplayDropdownbooleanfalsemake it true if use eachInputDropdown prop to turn each dropdown to manually controlled mode
fullTimeDropdownbooleanfalsemake it true if you want to activate full dropdown time see demo

Custom styling

If Default styles not applied :

Download and import on desired location :

Default Styles File

Edit Style for Desktop:

Input wrapper
.react-time-input-picker {
  // css code here
}
Hour input :
.react-time-input-picker #react-time-input-picker__hourInput {
  // css code here
}
Minute input :
.react-time-input-picker input#react-time-input-picker__minuteInput {
  // css code here
}
AmPm input :
.react-time-input-picker input#react-time-input-picker__amPm {
  // css code here
}
Focus style:
.react-time-input-picker input:focus {
  // css code here
}
or 
.react-time-input-picker input(//inputSelector):focus
{
  // css code here
}

Edit Styles on Mobile :

Input wrapper
.input-time-mobile {
  // css here
}

Keywords

FAQs

Package last updated on 20 Jun 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc