Skip to content

TimePicker

Time field with segmented hour/minute editing and an optional wheel popover; built on React Aria TimeField.

  • stable
  • since v0.1.0
  • 2.14 kB
  • forms

Each segment is role="spinbutton" with aria-valuemin/max/now; arrows adjust the focused segment.

Rendered as a segmented control — a clock icon, the hour/minute segments, and the chevron sit as raised tiles inside a tinted track (the same container the other inputs use); variant tints the track.

Preview
Open
tsx
import { TimePicker } from "@arshad-shah/cynosure-react";
import { Time } from "@internationalized/date";
<TimePicker aria-label="Meeting time" defaultValue={new Time(9, 30)} />

TimePicker accepts a Time value from @internationalized/date. The trigger opens a popover with a wheel picker for hours and minutes.

Use hourCycle to switch between 12-hour (12) and 24-hour (24) display.

Preview
Open
tsx

Set minuteStep to constrain the wheel’s minute column (e.g. 5-minute or 15-minute intervals).

Preview
Open
tsx

Drive the value from parent state with value and onChange.

Preview
Open
tsx
Preview
Open
tsx
PropTypeDefaultDescription
label
ReactNode
—
Visible label, also used as the picker's accessible name when a string.
size
"sm"|"md"|"lg"
—
Accepted for API parity with other form controls.
variant
"outline"|"filled"|"ghost"
"outline"
Visual treatment.
invalid
boolean
—
Renders the invalid state.
className
string
—
style
CSSProperties
—
minuteStep
number
1
Step in minutes for the wheel's minute column.
value
TimeValue|null
—
defaultValue
TimeValue|null
—
onChange
((value: TimeValue | null) => void)
—
  • Hour and minute segments are individual spinbuttons with aria-valuemin/aria-valuemax/aria-valuenow.
  • Arrow Up/Down change the focused segment; Arrow Left/Right move between segments.
  • The trigger button carries aria-label="Open time picker" and opens a Dialog with the wheel.
  • Provide an aria-label (or pass a label) so the whole field is announced as a time picker.
  • Pair with DatePicker for full date-and-time entry.
  • Use hourCycle={24} for backend-facing forms; hourCycle={12} for end-user scheduling.
  • Set minuteStep={15} for booking flows to keep slots aligned to common intervals.