Duolith docs

TimePicker

An hour and a minute, each a spinbutton with buttons above and below, and AM and PM where the locale uses a 12-hour clock.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe label above it, and the group's accessible name.
valuestringbindable("09:00")The time as "HH:MM" on the 24-hour clock, whatever the locale shows. Bind it with bind:value={name}.
stepnumber5How many minutes one press or arrow key moves; minutes land on multiples of it (1 to 30), from 0 to the last multiple in the hour, so a step of 7 gives 0, 7, ... 56.
localestringThe locale that decides the 12- or 24-hour clock and the AM and PM words; the device's when left out.
disabledbooleanfalseCannot be changed or focused.

States

StateLooks like
24-hourTwo-digit hours, such as 07 : 30.
12-hourHours 1 to 12 and an AM/PM pair beside them, the current one filled with primary.
focusedThe focus outline around the hours or minutes.
disabledThe whole part at 50% opacity.

Accessibility

rolegroup of two spinbuttons (Hours, Minutes) with aria-valuenow, aria-valuemin, aria-valuemax and aria-valuetext, and on a 12-hour clock a radiogroup of AM and PM
nameThe label prop names the group; the spinbuttons are Hours and Minutes.
focusTab reaches the hours, then the minutes, then the chosen half of the day. The buttons above and below are left out of the Tab order.
keyboardArrowUp and ArrowDown move the hour by one or the minutes by one step, wrapping; on a 12-hour clock the hour stays in its half of the day. PageUp and PageDown move the minutes by 15, or by one step when the step is larger, rounded to whole steps. Home and End jump to the first and last (for minutes, the last multiple of the step). The arrow keys move between AM and PM.

Theme tokens

color.surface color.border color.raised color.muted color.ink color.primary color.on-primary space.2 space.3 radius.md radius.sm text.label text.title text.caption

Example

<TimePicker label="Alarm" bind:value={alarm} />