ui-kit0.0

Forms

Time picker

Pick a time with the keyboard or a list.

Usage

Hour, minute and AM/PM are separate segments, like a native time input. Type digits (they move on by themselves), step with the arrow keys, clear with Backspace. Add step for a list of times to pick from; the current time is scrolled into view.

Stand-up starts at 09:30 (24-hour value).

When to use

  • A time of day in a form: a meeting, a pickup, opening hours.
  • Slots on a regular grid — add step and bound them with min and max.
  • Exact times such as 09:47 — the segments take any minute, with or without the list.

Not for: a duration (use a number input), a date and time together (pair a DatePicker with a TimePicker), or a free-form schedule (use your own scheduler).

Opening hours

Two pickers per row, each bounded by min and max. A value outside the bounds, or a closing time before opening, marks the field invalid.

Monday – Friday

Open 8:00 AM – 6:00 PM

Saturday

Open 10:00 AM – 2:00 PM

12 or 24 hours, seconds

The locale decides the clock: en-US is 12-hour with AM/PM, de-DE is 24-hour. Force one with hour12. seconds adds a third segment. The value is always a 24-hour string — HH:mm or HH:mm:ss — and null until every segment is filled.

Zürich HB → München Hbf. The value is always “HH:mm”.

With seconds: arrow keys step, digits move on by themselves.

API

TimePicker

PropTypeDefaultDescription
value / defaultValuestring | null—"HH:mm" ("HH:mm:ss" with seconds). Controlled or uncontrolled.
onValueChange(value: string | null) => void—Called as soon as every segment is filled, and with null when one is cleared.
localestring'en-US'Decides 12 or 24 hours and the AM/PM words.
hour12boolean—Force a 12-hour or 24-hour clock.
secondsbooleanfalseShow a seconds segment.
stepnumber—Minutes between times in the popover list. Without it there is no list.
min / maxstring—"HH:mm" bounds for the list; a value outside them is flagged invalid.
open / defaultOpen / onOpenChangeboolean—Control the list popover.
clearablebooleantrueClear button while anything is filled in.
disabled / requiredboolean—Also follow the surrounding Field.
namestring—Hidden input name; submits HH:mm.
size'sm' | 'md' | 'lg''md'Height: 32 / 36 / 44px.
labelsTimePickerLabels—Accessible names: hour, minute, second, period, clear, open, list.
...propsHTMLAttributes<HTMLDivElement>—Forwarded to the field (role="group"); give it an aria-label.

Helpers: parseTimeValue, formatTimeValue, formatTimeLabel, buildTimeOptions and resolveHour12 are exported.

Keyboard

KeyAction
0–9Fill the segment; moves on once the number is complete.
Arrow Up / DownStep the segment, wrapping around. On AM/PM: toggle.
Arrow Left / RightPrevious / next segment.
Home / EndLowest / highest value of the segment.
A / POn AM/PM: choose AM or PM.
Backspace / DeleteClear the segment; Backspace on an empty one goes back.
: . , SpaceNext segment.
Alt + Arrow DownOpen the list of times.
List: Arrows, Home, EndMove through the times; Enter or Space picks, Esc closes.

Accessibility

  • The field is a group; every segment is a spinbutton with a name, min, max, now and text value.
  • The list is a listbox of options with aria-selected; its button reports aria-expanded.
  • Soft keyboards work: the typed character is read from the input event when no key code arrives.
  • Keyboard focus shows a 3px ring on the whole field and fills the active segment.

Motion

  • The list rises in like every popover and leaves faster; the highlight on a segment fades in 150ms.
  • No press scale on the list button, because it opens a popup.
  • Reduced motion: the list only fades.