Dashral Pro is on the wayGet 30% off at launch

Dashral

Time Picker

A time picked from a list of steps or typed exactly, shown the locale's way, stored as HH:MM.

$ pnpm dlx shadcn@latest add https://dashral.com/r/time-picker.json

Every 30 minutes; type at the top for an exact time.

Installation

$ pnpm dlx shadcn@latest add https://dashral.com/r/time-picker.json

Adds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:

components.json
{
  "registries": {
    "@dashral": "https://dashral.com/r/{name}.json"
  }
}

Then add components by name:

$ pnpm dlx shadcn@latest add @dashral/time-picker

Usage

example.tsx
import { TimePicker } from "@/components/dashral/time-picker"

<TimePicker label="Start" value={start} onValueChange={setStart} min="08:00" max="18:00" step={15} />

Examples

Office hours, every 15 minutes

min, max and step bound the list; hour12 shows 2:30 PM.

Office hours, 8 AM to 6 PM.

Book a call

A DatePicker and a TimePicker side by side, the summary under them.

Book a call

Pick a day and a time.

API reference

TimePicker

PropTypeDefault
labelReactNode

Shown above, linked to the control.

—
descriptionReactNode

A hint under the control.

—
errorboolean | ReactNode

true shows the error style; a message also shows under the control.

—
labelActionReactNode

At the end of the label's row, e.g. a “Forgot password?” link or the current value.

—
withAsteriskboolean

Marks the label with an asterisk, e.g. alongside required.

false
value / defaultValuestring

The time as "HH:MM", 24-hour ("14:30"), whatever the display.

—
onValueChange(time: string | undefined) => void

Called when a time is picked or typed.

—
stepnumber

Minutes between the times in the list.

30
min / maxstring

The earliest and latest times offered.

"00:00" / "23:59"
hour12boolean

12-hour (2:30 PM) or 24-hour (14:30) display.

the locale's
placeholderstring

Shown while nothing is picked (translated by default).

"Pick a time"
localestring

BCP 47 locale for the display.

—
disabled / required / id

As on any field.

—
classNames{ root, label, description, error, trigger, content, option }

Classes for each part.

—
classNamestring

The trigger's classes.

—

Keyboard

KeysAction
EnterorSpaceOpen
↓or↑Move through the times
Page DownorPage UpMove six at a time
HomeorEndThe first or last time
EnterPick the time (or the one typed at the top)
EscapeClose

Accessibility

  • With label, description or error, the id, aria-describedby and aria-invalid are wired up for you.
  • The times are a listbox of options, the picked one aria-selected; opening it puts the focus on the picked time.

Motion

  • Opens with a fade, a scale from 95%, a 2px blur clearing and a 4px slide from its trigger's side, on the spring (--duration-standard); closes faster (--duration-fast, --ease-exit). No blur with reduced motion.