0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Form-associated time input with combobox text entry, spinbutton dropdown, 12h/24h format, and progressive enhancement over native input[type=time].
Overview
The <time-picker> component wraps a native <input type="time"> and provides a combobox text input with an optional spinbutton dropdown panel. Users can type a time directly (e.g. “2:30pm”, “14:30”, “3pm”) or click the clock icon to adjust via spinbuttons. It supports 12-hour and 24-hour formats (localised through Intl), enforces min, max and step from the native input, can be left empty, and participates in form submission and validation via ElementInternals.
Initial time in HH:MM or HH:MM:SS. It is also the form-reset target. Omit it for an empty field.
min
Earliest valid time (e.g. 09:00). Spinners stop at it; a typed earlier time is kept and flagged rangeUnderflow.
max
Latest valid time (e.g. 17:00). Spinners stop at it; a typed later time is flagged rangeOverflow. A min later than max is an overnight range (e.g. 22:00–06:00).
step
Step in seconds, counted from min (default 60; any turns step checks off). Use 900 for 15-minute intervals. Values that are not whole minutes show a seconds spinner; whole hours (3600, 7200) step the hours spinner.
Labels
Every UI string can be overridden with a data-label-* attribute on the host. Validation messages can also come from a data-message-*attribute on the inner input, which wins.
Choose a valid time. The nearest are {lower} and {upper}
12-Hour Format
Set data-format="12h" to display an AM/PM toggle alongside the hour and minute spinners. The display text and the AM/PM words come from Intl.DateTimeFormat for the nearest [lang], so lang="ja" shows “午後2:30” with the period toggle first. Typed input accepts the localised words as well as am/pm.
The stepattribute on the native input sets the grid, counted from min. With step="900" the spinners move in 15-minute steps and snap an off-grid value onto the grid. A typed off-grid time such as 10:07 is kept as typed and flagged stepMismatch, like a native input. With an hour-scale step such as 7200 the hours spinner moves two hours at a time and the minutes spinner is read-only.
The component is form-associated via ElementInternals and works inside <form-field> for validation messaging. The host owns validity (valueMissing, rangeUnderflow, rangeOverflow, stepMismatch) and anchors it on the text input. An empty picker submits nothing. Clearing the text and pressing Enter (or leaving the field), or setting .value = '', clears it. Form reset restores the authored valueattribute, even after the element has been moved.
Open the spinbutton panel and focus the first spinner.
Escape
Close the panel and revert display to the current value.
Tab
Move focus to the next element. The panel closes whenever focus leaves the component.
Spinbutton panel
Key
Action
Arrow Up / Arrow Down
Increment / decrement the focused segment.
Arrow Left / Arrow Right
Move focus between segments (hours, minutes, seconds, AM/PM).
Page Up / Page Down
Increment / decrement the focused segment by a larger step: minutes and seconds by 10, or by the next multiple of step at or above 10 (15 for a 15-minute step); hours by one step, the same as the arrow keys. The value wraps within the segment, so the other segments do not change.
Home / End
Jump to minimum / maximum value for the segment.
0–9
Direct number entry into the focused segment.
Escape
Close the panel and return focus to the text input.
Events
Event
Detail
Description
time-picker:change
{ value, hours, minutes, seconds, source }
Fired when the value actually changes (not on form reset or restore). value is '' when cleared, with hours/minutes/secondsnull. source is 'api', 'pointer' or 'keyboard'.
Accessibility
The text input is a role="combobox" with aria-haspopup="dialog", aria-expanded and aria-controls pointing at the spinner popup, which is a non-modal role="dialog".
The combobox is named by the inner input’s <label for> (forwarded with aria-labelledby, since the native input is hidden), a <label for> on the host, or an aria-label.
Each segment is a role="spinbutton" with aria-valuenow, aria-valuemin, aria-valuemax and a localised aria-valuetext (“2 PM”, “30 minutes”, or “Not set” while empty). The increment/decrement buttons are aria-hidden; the keyboard works on the spinbutton itself.
aria-invalid and aria-required are set on the combobox.
Focus rings use outline, so they stay visible in forced-colors mode.
Touch devices and the native picker
The picker keeps its own UI on every device: the text field accepts typing from any on-screen keyboard and the spinners work with taps. It does not swap in the native <input type="time"> on coarse pointers, so a form looks and validates the same everywhere. If you want the operating system’s time wheel on phones, use a bare <input type="time"> without the <time-picker> wrapper. That is the same markup the component enhances, so nothing else changes.