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

@theawesomecoder/react-timepicker

v0.0.4

Published

A lightweight React time picker component

Readme

React Time Picker

A lightweight, accessible React time picker component for JavaScript and TypeScript. Pick times in 12- or 24-hour format with a clock-style dial, built on Radix UI and React Aria for accessibility and keyboard support.


Features

  • 12- and 24-hour formats — Support for both time formats out of the box
  • Accessible — Built with Radix UI Dialog and React Aria Components for focus management, keyboard navigation, and screen readers
  • Lightweight — Minimal dependencies; no heavy UI framework required
  • TypeScript — Full type definitions included
  • Customizable — Custom buttons, themes, min/max time, and minute step (e.g. 5-minute intervals)
  • Controlled or uncontrolled — Use value / timeSet for controlled usage or leave unset for local state

Requirements

  • React ≥ 17
  • React DOM ≥ 17

Installation

Install the package from npm:

npm install react-timepicker

Or with Yarn:

yarn add react-timepicker

Or with pnpm:

pnpm add react-timepicker

Quick Start

  1. Import the styles (required for the dialog and layout to display correctly):
import 'react-timepicker/styles.css';
  1. Import and render the component:
import { ReactTimepicker } from 'react-timepicker';

function App() {
  return (
    <ReactTimepicker
      value="14:30"
      format={24}
      timeSet={(time) => console.log('Selected:', time)}
    />
  );
}

Usage Examples

Basic (24-hour format)

import 'react-timepicker/styles.css';
import { ReactTimepicker } from 'react-timepicker';

<ReactTimepicker format={24} />

12-hour format with AM/PM

<ReactTimepicker format={12} defaultTime="09:00 AM" />

Controlled component

const [time, setTime] = useState('10:30');

<ReactTimepicker
  value={time}
  format={24}
  timeSet={setTime}
  timeChanged={setTime}
/>

5-minute step and min/max time

<ReactTimepicker
  format={24}
  minutesGap={5}
  min="09:00"
  max="18:00"
  timeSet={(t) => console.log(t)}
/>

Callbacks: open, close, and time change

<ReactTimepicker
  opened={() => console.log('Opened')}
  closed={() => console.log('Closed')}
  timeSet={(time) => console.log('Confirmed:', time)}
  timeChanged={(time) => console.log('Changed:', time)}
/>

Custom cancel and confirm buttons

<ReactTimepicker
  cancelBtnTmpl={<button>Cancel</button>}
  confirmBtnTmpl={<button>Done</button>}
  timeSet={(time) => console.log(time)}
/>

TimepickerField (with React Aria TimeField)

For an alternative UX that combines the clock picker with a keyboard-friendly time field:

import 'react-timepicker/styles.css';
import { TimepickerField } from 'react-timepicker';

<TimepickerField ariaLabel="Select time" format={24} disabled={false} />

API Reference

ReactTimepicker props

| Prop | Type | Default | Description | |------|------|---------|-------------| | value | string | — | Current time (e.g. "14:30" or "02:30 PM"). Use with timeSet / timeChanged for controlled mode. | | format | 12 \| 24 | 24 | 12- or 24-hour format. | | defaultTime | string | "12:00 AM" | Default time when uncontrolled. | | disabled | boolean | false | Disable the timepicker (input and trigger). | | disableClick | boolean | false | Disable only the input click (e.g. keep icon clickable). | | displayInput | boolean | true | Show or hide the time input; false shows only the trigger/icon. | | min | string \| DateTime | — | Minimum selectable time. | | max | string \| DateTime | — | Maximum selectable time. | | minutesGap | number | 1 | Minute step (e.g. 5 for 00, 05, 10…). | | hoursOnly | boolean | false | Show only hours, hide minutes. | | ESC | boolean | true | Allow closing with Escape key. | | preventOverlayClick | boolean | false | Prevent closing when clicking the overlay. | | enableKeyboardInput | boolean | true | Enable keyboard input for time. | | disableAnimation | boolean | false | Disable open/close animation. | | timeSet | (time: string) => void | — | Called when the user confirms the time (e.g. OK). | | timeChanged | (time: string) => void | — | Called when the time changes on the clock dial. | | opened | () => void | — | Called when the dialog opens. | | closed | () => void | — | Called when the dialog closes. | | hourSelected | (hour: number) => void | — | Called when an hour is selected. | | cancelBtnTmpl | ReactNode | — | Custom cancel button. | | confirmBtnTmpl | ReactNode | — | Custom confirm button. | | editableHintTmpl | ReactNode | — | Custom hint for editable input. | | theme | ReactNode | — | Custom theme/overrides. | | timepickerClass | string | — | Extra CSS class for the timepicker container. |

TimepickerField props

| Prop | Type | Default | Description | |------|------|---------|-------------| | ariaLabel | string | — | Accessible label for the time field (required). | | format | 12 \| 24 | 24 | 12- or 24-hour format. | | disabled | boolean | false | Disable the field. |


Styling

The component ships with a self-contained stylesheet. Always import it once in your app:

import 'react-timepicker/styles.css';

You can override styles with your own CSS or pass timepickerClass for a wrapper class. The dialog uses Radix UI primitives, so you can also target [data-radix-dialog-overlay] and [data-radix-dialog-content] if needed.


License

MIT © Abhishek Kumar