Time Picker
ProNewA list of times at a fixed step, labelled in the locale's 12-hour or 24-hour form.
Installation
pnpm dlx shadcn@latest add @viewport/time-picker
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| value | stringThe time as `HH:mm` in 24-hour form, e.g. `"14:30"`. | — |
| defaultValue | string | — |
| onValueChange | (value: string) => void | — |
| step | numberMinutes between options. | 30 |
| min | stringThe first and last options, as `HH:mm`. | "00:00" |
| max | string | "23:59" |
| placeholder | stringShown while no time is chosen. | "Pick a time" |
| locale | stringA BCP 47 tag. It decides between 12-hour and 24-hour labels. | — |
| name | stringSubmits the `HH:mm` value with a form. | — |
Accessibility
- Built on Radix Select: arrow keys and typeahead, opening on the chosen time.
- Submits a 24-hour `HH:mm` value with forms.
- No scale animation under reduced motion.