Skip to content
satin

Time picker

Takes a typed time or one from a list, alone or with a day.

Book a client demo

Installation

Terminal
npm i @uisatin/ui
Import
import { TimePicker, type TimeValue } from '@uisatin/ui/time-picker'

About 59.2 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

TimePicker is a text field with the Input skin that reads a typed time ("930", "9:30pm", "1430") or opens a list of times under it; its value is { hours, minutes }, null when cleared or typed wrong. DateTimePicker is the Date picker field opening the Calendar with a column of times beside it; its value is a Date. TimeList and DateTimePickerPanel are the list and the panel on their own. Times are written in the dateLocale label, 12- or 24-hour as that locale writes them; with name, a hidden input submits HH:mm or YYYY-MM-DDTHH:mm.

PropTypeDefault
TimePicker.value
{ hours: number, minutes: number }null
—
TimePicker.defaultValue
TimeValuenull
—
TimePicker.onValueChange
(value: TimeValue | null) => void
—
TimePicker.min / max
TimeValue
—
DateTimePicker.value
Datenull
—
DateTimePicker.defaultValue
Datenull
—
DateTimePicker.onValueChange
(value: Date) => void
—
DateTimePicker.min / max
Date
—
DateTimePicker.minTime / maxTime
TimeValue
—
step
number
15
isTimeDisabled
(time: TimeValue, day?: Date | null) => boolean
—
format
"12h""24h"
the locale's
open / defaultOpen
boolean
—
onOpenChange
(open: boolean) => void
—
name
string
—
label / hint / error
ReactNode
—
className
string
—
ref
Ref<HTMLInputElement>
—
...props
ComponentProps<'input'>

Other attributes go to <input>

—

Accessibility

TimePicker's field is a combobox named by its label and described by a format hint ("Type a time like 2:30 PM", timeHint in SatinLabels) and by the hint or error. Focus stays in it while the listbox of times is open; aria-activedescendant follows the highlighted time. Each time is an option: the picked one aria-selected, unavailable ones aria-disabled. Typed text that isn't an available time sets aria-invalid and says why under the field (timeInvalid, timeUnavailable). The chevron, "Show times", is out of the tab order. DateTimePicker's field is a button that opens the Calendar (as on Date picker) with the times as a listbox named "Time"; picking a day with no time yet moves focus to the times. A pick there sets the value and leaves the panel open, and the focus where it was, so the change is heard as the time becoming selected.

KeyAction
↓or↑On the field: opens the list on the picked time, then moves to the next or previous available time.
Alt+↓orAlt+↑Opens or closes the list without moving the highlight.
Page DownorPage UpMoves an hour on or back.
HomeorEndIn TimeList and the date-and-time panel: the first or last available time. In the field they move the caret.
0–9orAorPType-ahead: the list jumps to the time typed so far ("14", "2p"). In a TimeList a second's pause starts over.
EnterPicks the highlighted time once the arrows or the pointer moved there and closes the list; otherwise reads what was typed ("930", "9:30pm"). In a TimeList, Space picks too. In the date-and-time panel a pick leaves it open; Enter on the time already picked closes it and returns focus to the field.
EscCloses the list and leaves focus in the field (the date-and-time panel returns it to the field). With the list closed, puts back the time the field showed.
TabReads what was typed, closes the list and moves on.