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

timepicker-ui-react

v1.7.0

Published

Official React wrapper for timepicker-ui v4.x

Readme

timepicker-ui-react

React component for timepicker-ui v4. It's a thin wrapper: the picker, its options, events and types all come from the core library, and this package only hooks it into React's lifecycle.

npm version license downloads

Demo and docs · Changelog · Core library

Why use it

  • No types of its own that could drift out of sync. Everything is re-exported from timepicker-ui.
  • Controlled (value) or uncontrolled (defaultValue), like a normal input.
  • Accepts any <input> prop: className, name, disabled, aria-*, ...
  • Renders <div class="tp-ui"><input></div> on the server and becomes the picker after hydration, so Next.js, Remix and Astro work.
  • Range, timezone and wheel plugins work the same as in the core.

Installation

npm install timepicker-ui-react

Needs React 17 or newer. The package is ESM only.

timepicker-ui gets installed with it. With pnpm or Yarn PnP, add timepicker-ui (same version) to your own dependencies too, since your code imports its CSS directly.

Quick start

import { Timepicker } from "timepicker-ui-react";
import "timepicker-ui/main.css";

function App() {
  return (
    <Timepicker
      placeholder="Select time"
      onConfirm={(data) => console.log("Selected:", data)}
    />
  );
}

Props

<Timepicker
  options={options}                 // TimepickerOptions, same as the core
  value={time}                      // controlled, the input becomes read-only
  defaultValue="12:00 AM"           // uncontrolled
  onConfirm={(data) => {}}
  onCancel={(data) => {}}
  onOpen={(data) => {}}
  onShow={(data) => {}}
  onUpdate={(data) => {}}
  onSelectHour={(data) => {}}
  onSelectMinute={(data) => {}}
  onSelectSecond={(data) => {}}     // with clock.showSeconds
  onSelectPeriod={(data) => {}}     // data.type is "AM" or "PM"
  onSwitchView={(data) => {}}       // with ui.viewSwitch
  onSwitchFace={(data) => {}}       // data.face: "hours", "minutes" or "seconds"
  onClear={(data) => {}}
  onError={(data) => {}}
  onTimezoneChange={(data) => {}}   // timezone plugin
  onRangeConfirm={(data) => {}}     // range plugin
  onRangeSwitch={(data) => {}}
  onRangeValidation={(data) => {}}
  onRangeChange={(data) => {}}      // data.part, data.from, data.to
  onWheelScrollStart={(data) => {}} // wheel plugin
  onWheelScrollEnd={(data) => {}}
  className="my-input"              // and any other <input> prop
  placeholder="Select time"
/>

onError is the picker's error callback, not the DOM error event.

Docs: props, events

Options

Same as the core (full list).

<Timepicker
  options={{
    clock: { type: "24h", autoSwitchToMinutes: true },
    ui: { theme: "m3-green", mode: "clock", clearButton: true },
    labels: { ok: "Confirm", cancel: "Close" },
    behavior: { focusTrap: true },
    wheel: { placement: "auto", commitOnScroll: false },
  }}
/>

Seconds are off by default. With clock.showSeconds: true the picker gets a seconds field and values read HH:MM:SS (HH:MM:SS AM in 12h):

<Timepicker options={{ clock: { showSeconds: true } }} />;

clock.isTimeDisabled takes a function. Keep it stable (useCallback or a module-level function): a new function on every render counts as new options, and the wrapper re-applies them, which resets an open picker. When the data the function reads changes, call refreshDisabledTime() on the core instance:

const isTimeDisabled = useCallback(({ hour }: TimeOfDay) => hour < 9 || hour >= 17, []);

<Timepicker options={{ clock: { isTimeDisabled }, behavior: { id: "shift" } }} />;

TimepickerUI.getById("shift")?.refreshDisabledTime();

The same instance gives you setView(), getView() and clear(), and the range methods setRange(), getRange(), getActivePart(), setActivePart() and setRangeCaptions(). setRange({ from }) or setRange({ to }) changes one end.

parseTime(), formatTime() and createDisabledTimeCheck() are re-exported too. They work without a picker.

Themes

12 themes, same as the core. main.css is required and already includes basic. The others are separate imports:

import "timepicker-ui/main.css";
import "timepicker-ui/theme-dark.css";

<Timepicker options={{ ui: { theme: "dark" } }} />;

Plugins

Register them once, before rendering any picker. PluginRegistry is re-exported from this package.

import { PluginRegistry } from "timepicker-ui-react";
import { RangePlugin } from "timepicker-ui/plugins/range";
import { TimezonePlugin } from "timepicker-ui/plugins/timezone";
import { WheelPlugin } from "timepicker-ui/plugins/wheel";

PluginRegistry.register(RangePlugin);
PluginRegistry.register(TimezonePlugin);
PluginRegistry.register(WheelPlugin);

<Timepicker options={{ ui: { mode: "wheel" } }} />
<Timepicker options={{ range: { enabled: true } }} onRangeConfirm={(data) => {}} />
<Timepicker options={{ timezone: { enabled: true } }} onTimezoneChange={(data) => {}} />

Next.js

The component uses hooks, so in the App Router it has to live in a client component:

"use client";

import { Timepicker } from "timepicker-ui-react";
import "timepicker-ui/main.css";

export default function Page() {
  return <Timepicker options={{ clock: { type: "12h" } }} />;
}

Types

All core types and the TimepickerUI, EventEmitter, PluginRegistry, parseTime, formatTime and createDisabledTimeCheck values are re-exported (TypeScript docs):

import type { TimepickerOptions, CallbacksOptions, ConfirmEventData, ... } from "timepicker-ui-react";
import { TimepickerUI, EventEmitter, PluginRegistry } from "timepicker-ui-react";

Development

cd src
npm run build     # output in ../dist
npm test
npm run dev       # demo on http://localhost:3000

Contributing

Issues and PRs welcome on GitHub.

License

MIT © Piotr Glejzer