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 🙏

© 2026 – Pkg Stats / Ryan Hefner

time-picker-input

v1.0.2

Published

A customizable React time input component that enforces 12-hour or 24-hour format, bypassing OS and browser settings for consistent time input across all platforms

Readme

Time Picker Input

A customizable React time input component that enforces 12-hour or 24-hour format, bypassing OS and browser settings for consistent time input across all platforms.

Features

  • 🎯 Format Enforcement: Enforce 12-hour or 24-hour format regardless of OS/browser settings
  • 🎨 Customizable: Built with Tailwind CSS and fully customizable styling
  • Accessible: Built on Radix UI primitives for full accessibility support
  • ⌨️ Keyboard Friendly: Full keyboard navigation support
  • 📱 Mobile Friendly: Touch-friendly time picker with scrollable lists
  • 🎭 TypeScript: Full TypeScript support with exported types

Installation

npm install time-picker-input

Peer Dependencies

This package requires the following peer dependencies:

npm install react react-dom tailwindcss

Usage

Basic Example

import { useState } from "react";
import { TimeInput } from "time-picker-input";

function App() {
  const [time, setTime] = useState("");

  return (
    <TimeInput
      value={time}
      onChange={setTime}
      format={24} // or 12 for 12-hour format
    />
  );
}

12-Hour Format

import { TimeInput } from "time-picker-input";

<TimeInput
  value={time}
  onChange={setTime}
  format={12}
/>

With Form Integration

import { TimeInput, TimeInputProps } from "time-picker-input";

function MyForm() {
  const [time, setTime] = useState("14:30");

  return (
    <form>
      <label>
        Select Time:
        <TimeInput
          value={time}
          onChange={(value) => setTime(value)}
          onBlur={() => console.log("Time input blurred")}
          format={24}
          className="w-full"
        />
      </label>
    </form>
  );
}

With Error Styling

<TimeInput
  value={time}
  onChange={setTime}
  className="border-red-500 focus-within:ring-red-500"
/>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | value | string | required | Time value in HH:mm format (24-hour format internally) | | onChange | (value: string) => void | required | Callback fired when time changes | | onBlur | () => void | undefined | Callback fired when input loses focus | | disabled | boolean | false | Disables the input | | className | string | undefined | Additional CSS classes | | format | 12 \| 24 | 24 | Time format to display (12-hour or 24-hour) |

Value Format

The component always stores and returns time values in 24-hour format (HH:mm), regardless of the display format:

  • "00:00" - Midnight (12:00 AM in 12-hour format)
  • "12:00" - Noon (12:00 PM in 12-hour format)
  • "14:30" - 2:30 PM (2:30 PM in 12-hour format)
  • "23:59" - 11:59 PM

Styling

The component uses Tailwind CSS and follows shadcn/ui design patterns. You can customize the appearance by:

  1. Passing className prop: Add custom classes to override default styles
  2. CSS Variables: The component uses CSS variables for theming. Ensure your Tailwind config includes the necessary color variables:
:root {
  --background: 0 0% 100%;
  --foreground: 220 39% 11%;
  --primary: 218 91% 59%;
  --primary-foreground: 0 0% 98%;
  --muted: 220 14% 96%;
  --muted-foreground: 220 8.9% 46.1%;
  --accent: 220 14% 96%;
  --accent-foreground: 220 39% 11%;
  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 218 91% 59%;
  --popover: 0 0% 100%;
  --popover-foreground: 220 39% 11%;
}

Keyboard Navigation

  • Tab: Navigate between hours and minutes inputs
  • Arrow Right / Colon (:) : Move from hours to minutes
  • Arrow Left: Move from minutes to hours
  • Enter: Move to minutes when hours input is complete
  • Numbers: Direct input of time values

Browser Support

Works in all modern browsers that support:

  • React 18+
  • CSS Grid and Flexbox
  • ES6+ JavaScript

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.