Time Picker
A popover with hour and minute columns that picks a wall time.
Usage guidelines
- Use
TimePickerfor a wall time stored as 24-hourHH:mm, such as a daily schedule. UseDatePickerfor a civil dateYYYY-MM-DDandDateTimePickerfor an instant (Date) shown in an IANA time zone. The pickers do not accept typed text. timeZoneonly sets Now and the initial empty draft; it never converts the stored wall time. Parse API payloads and convert business values outside the picker.- Name the field at the call site: prefer one visible picker Label. It names both the trigger and the popup through
aria-labelledby, and clicking its text focuses the trigger without opening it. A Label withclassName="sr-only"names a compact field without visible text.FieldLabel nativeLabel={false} render={<div />}also works. Do not point a nativelabel[for]at the trigger: activating it clicks the button. - Without a Label, name the trigger and the content with
aria-labeloraria-labelledby. The trigger's name appends its visible value (or placeholder) to label text; an explicitaria-labelreplaces the whole name, so include the visible value in it. Put meaningful annotations inside the Value part so they join the name. - Name Clear explicitly: Clear follows the
IconButtonnaming contract, so give it anaria-labelsuch as "Clear start date". Place it next to the trigger, never inside the trigger button. - Use
defaultValue, orvaluewithonValueChange, and keep that choice for the field's lifetime.nullmeans empty, and Clear emitsnull.details.reasonisitem-press,clear-pressorreset;details.cancel()rejects that change and its follow-up close. Unchanged values do not emit again. - Edits in the popup, including Now, stay in a draft until OK. Close,
Escapeand an outside press discard the draft, and reopening starts from the committed value. hourCycleswitches between 12-hour (default) and 24-hour display; the stored value stays 24-hour.minuteStep(1, 5, 10, 15, 20 or 30) limits the minute column, and Now rounds down to that step. A value off the step counts as unavailable.isTimeUnavailablechecks the complete time. Unavailable drafts stay reachable while you move through the columns, but OK is disabled and the reason is announced.- Content keeps its natural height and flips above or below the trigger; it does not shrink on small screens. Pass
maxHeightonly to opt into scrolling the body while the actions stay visible. localetakes an Intl locale identifier and changes formatting and digits, not the stored value. Translate action labels throughlabels, plus placeholders,requiredLabelandvalidationMessage. Direction comes from the nearestDirectionProvider; for a local RTL region, also setdiron the wrapper and on the content.- With
name, the committed value joins nativeFormData, and an empty field submits''. Inside aField,Field.nametakes precedence,validatereceives the domain value, andForm.onFormSubmitreceives the same strings asFormData. Required and invalid fields block submission and focus the first invalid trigger. Reset restoresdefaultValue. Disabled fields are left out; read-only fields open for browsing and still submit.
Anatomy
TimePickerTrigger is a native button whose default children are the Value and a decorative clock icon. When you replace them, include exactly one TimePickerValue and keep the trailing clock icon; its render callback receives the formatted text, not the raw value. TimePickerContent owns the portal, initial focus, columns and actions.
Examples
Minute step and 24-hour display
hourCycle={24} drops the period column, and minuteStep={15} offers quarter hours. The time-zone suffix lives inside TimePickerValue, so it is part of the trigger's name.
Unavailable times
isTimeUnavailable blocks business hours here. You can still move through them, but OK stays disabled until the draft is available.
30-minute steps; 9:00 AM–5:59 PM is unavailable.
Controlled value in a form
The controlled value changes only when OK confirms the draft. Inside a Field, onFormSubmit receives the HH:mm string.
Keyboard
| Key | Action |
|---|---|
| EnterorSpace | Opens the popup from the trigger and focuses the selected hour. |
| Up arroworDown arrow | Selects the previous or next option in the draft, stopping at the ends. |
| PageUporPageDown | Moves the selection five options. |
| HomeorEnd | Selects the first or last option. |
| Digits | Selects the option that starts with the typed number. |
| Tab | Moves between the columns, Now and OK, wrapping inside the popup. |
| EnterorSpace | On OK, commits the draft, closes the popup and returns focus to the trigger. |
| Escape | Discards the draft, closes the popup and returns focus to the trigger. |
API reference
TimePicker
Groups all parts of a wall-clock time picker storing a 24-hour HH:mm value. Doesn't render its own HTML element.
Popup edits stay in a draft until confirmed with the apply button; timeZone affects only the "Now" shortcut and initial empty draft.
| Prop | Type | Default | Details |
|---|---|---|---|
placeholder | string | No default | |
disabled | boolean | false | |
readOnly | boolean | false | |
required | boolean | false | |
requiredLabel | string | 'Required' | |
invalid | boolean | false | |
name | string | No default | |
form | string | No default | |
validationMessage | string | No default | |
onOpenChange | ((open: boolean, details: PickerOpenChangeDetails) => void) | No default | |
children required | React.ReactNode | No default | |
hourCycle | 12 | 24 | 12 | |
minuteStep | 1 | 5 | 10 | 15 | 20 | 30 | 1 | |
value | string | null | No default | |
defaultValue | string | null | null | |
onValueChange | ((value: string | null, details: TimePickerChangeEventDetails) => void) | No default | |
isTimeUnavailable | ((value: string) => boolean) | No default | |
locale | Intl.LocalesArgument | 'en-US' | |
timeZone | string | No default | |
labels | Partial<TimePickerLabels> | No default | |
defaultOpen | boolean | false | |
open | boolean | No default | |
TimePickerClear
A button component that can be used to trigger actions. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
aria-label | string | No default | |
aria-labelledby | string | No default | |
variant | 'default' | 'ghost' | 'ghost-accent' | 'primary' | 'secondary' | 'secondary-accent' | 'tertiary' | 'default' | |
tone | 'default' | 'destructive' | 'default' | |
ref | React.Ref<HTMLButtonElement> | No default | |
className | string | ((state: ButtonState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: ButtonState) => React.CSSProperties | undefined) | No default | |
focusableWhenDisabled | boolean | false | |
Valid prop combinations:
aria-label: string,aria-labelledby?: undefined,variant?: 'default' | 'ghost' | 'primary' | 'secondary' | 'tertiary',tone?: 'default' | 'destructive'aria-label: string,aria-labelledby?: undefined,variant: 'ghost-accent' | 'secondary-accent',tone?: 'default'aria-label?: undefined,aria-labelledby: string,variant?: 'default' | 'ghost' | 'primary' | 'secondary' | 'tertiary',tone?: 'default' | 'destructive'aria-label?: undefined,aria-labelledby: string,variant: 'ghost-accent' | 'secondary-accent',tone?: 'default'
| Attribute | Description |
|---|---|
data-disabled | Present when the button is disabled. |
TimePickerContent
A container for the popover contents. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
sideOffset | number | OffsetFunction | 8 | |
align | 'center' | 'end' | 'start' | 'start' | |
className | string | ((state: PopoverPopupState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: PopoverPopupState) => React.CSSProperties | undefined) | No default | |
side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'bottom' | |
alignOffset | number | OffsetFunction | 0 | |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null) | No default | |
| Attribute | Description |
|---|---|
data-open | Present when the popup is open. |
data-closed | Present when the popup is closed. |
data-starting-style | Present when the popup begins animating in. |
data-ending-style | Present when the popup is animating out. |
data-side | Values: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
data-instant | Values: Present if animations should be instant. |
| Variable | Description |
|---|---|
--popup-width | The width of the popup. |
--popup-height | The height of the popup. |
TimePickerLabel
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: FieldRootState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: FieldRootState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-disabled | Present when the component should ignore user interaction. |
data-touched | Present when the field has been touched. |
data-dirty | Present when the field value has changed from its initial value. |
data-filled | Present when the field has a value. |
data-focused | Present when the field is focused. |
TimePickerTrigger
A button that opens the popover. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
ref | React.Ref<HTMLButtonElement> | No default | |
id | string | No default | |
className | string | ((state: PopoverTriggerState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: PopoverTriggerState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-readonly | Present when the picker is read-only. |
data-required | Present when the picker requires a value. |
data-popup-open | Present when the corresponding popover is open. |
data-pressed | Present when the trigger is pressed. |
data-disabled | Present when the trigger is disabled. |
TimePickerValue
| Prop | Type | Default | Details |
|---|---|---|---|
children | ((displayValue: string) => React.ReactNode) | React.ReactNode | No default | |