Stored as 09:30 – 17:00 (24-hour)
Installation
$ pnpm dlx shadcn@latest add @synccn/time-pickerFirst time in this project? Connect synccn with one command.
Usage
import { TimePicker } from "@/components/ui/time-picker";<TimePicker value="09:30" step={15} />API reference
Generated from the component's TypeScript types, so it always matches the code.
TimePicker
value is "HH:MM" in 24-hour time; shown in 12-hour time with AM/PM.
PropTypeDescription
- value
stringControlled time as "HH:MM" (24-hour).
- defaultValue
stringDefault
"09:30"Initial time when uncontrolled.
- onValueChange
(value: string) => voidCalled with the new "HH:MM" time.
- step
numberDefault
5Minutes between options.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Clock
Keyboard
- EscClose the panel
- TabMove between hour, minute and AM/PM
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: listbox, option
- ARIA attributes: aria-expanded, aria-label, aria-selected
- Closes with Escape
- Closes when you click or tap outside
- Flips to whichever side has room, so it stays on screen
- Shows a visible focus ring for keyboard users
More inputs
ButtonSeven variants, four sizes and a built-in loading state.InputText field with optional leading icon and invalid state.TextareaMulti-line field that grows with its content and counts characters.CheckboxChecked, unchecked and indeterminate, with label and description.SwitchToggle with a springy thumb in three sizes.Radio GroupPick one option, shown as dots or as selectable cards.