npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-time-picker-lite

v1.0.3

Published

![](https://res.cloudinary.com/dcupoxygs/image/upload/v1576104565/react-time-picker/demo3.gif)

Downloads

5

Readme

react-time-picker-lite

A simple, lightweight React time picker. Requires React 16.8.0 or higher.

  • Supports typed input only (no dropdowns).
  • Rejects input characters that would create an invalid time sting, and resets if input is not a complete, valid time string when unfocussed.
  • Try demo here

Installation

npm install react-time-picker-lite

Basic Example

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

function App() {
  const [timeMessage, setTimeMessage] = useState(null);
  const [errorMessage, setErrorMessage] = useState(null);
  
  const handleSuccess = (hhmmString) => {
    setTimeMessage(`Time is set to ${hhmmString}.`);
    setErrorMessage(null);
  };

  const handleError = () => {
    setErrorMessage('Please insert a valid time.');
    setTimeMessage(null);
  };

  return (
    <div>
      <TimePicker
        onSuccess={handleSuccess}
        onError={handleError}
      />
      {timeMessage || errorMessage || ''}
    </div>
  );
}

Props

|Prop name|Description|Data Type|Default Value| |----|----|----|----| |placeholderText|The value to display in the time input before it's facussed|String|'Set Time'| |wrapperWidth|The width of the wrapper containing both the input and the AM/PM buttons|String|'120px'| |wrapperHeight|The height of the warpper containing both the input and the AM/PM buttons|String|'150px'| |inputHeight|The height of the input|String|'30%' (of the wrapper)| |inputWidth|The width of the input|String|'100%' (of the wrapper)| |inputFontSize|Font size for input text|String|'20px'| |backgroundColorOnBlur|Color of input background when blurred|String|'#000' (black)| |textColorOnBlur|Color of input text when blurred|String|'#FFF' (white)| |backgroundColorOnfocus|Color of input background when focussed|String|'#FFF' (white)| |textColorOnfocus|Color of input text when focussed|String|'#000' (black)| |font|Font to be applied to input and AM/PM button text|String|'inherit'| |amPmButtonHeight|Height of AM/PM button|String|'25%' (of the wrapper)| |amPmButtonWidth|Width of AM/PM button|String|'25%' (of the wrapper)| |amPmButtonFontSize|Font size for the AM/PM button text|String|'10px'| |amPmButtonHighlightedBackgroundColor|Color of AM/PM button background when selected|String|'#000' (black)| |amPmButtonNonHighlightedBackgroundColor|Color of AM/PM button background when unselected|String|'#FFF' (white)| |amPmButtonHighlightedTextColor|Color of AM/PM button text when selected|String|'#FFF' (white)| |amPmButtonNonHighlightedTextColor|Color of AM/PM button text when unselected|String|'#000' (black)| |onError|Function that is called when input is reset due to invalid time value|Function|() => null| |onSuccess|Function that is called when input is unfocussed with valid time value. Includes 'HH:mm' (in 24-hour format) as argument|Function|() => null| |shouldUse24HourMode|Allows input to use 24 hour time (hides AM/PM buttons if set to true)|Boolean|false|