Time Picker
A time field of typeable spinbuttons in 12- or 24-hour time, with a quick list; the value is always HH:MM.
Rendering Time Picker…
Installation
Copy the source into your project with the CLI. It lands under @/components/ui and is yours to edit.
npx mlola-ui add time-pickerUsage
import { TimePicker } from "@/components/ui/time-picker";
export default function Example() {
return <TimePicker label="Reminder" defaultValue="09:30" step={15} hourCycle={24} />;
}Styling comes from the engine stylesheet and the nearest theme. Set it once at the root:
<html data-theme="graphite" data-mode="light">HTML
The markup the example above renders, at rest. The interaction lives in the React component; from another framework, set the attributes below as the state changes.
<div class="ml-input-field ml-time-picker">
<label class="ml-input-label" id="time-picker-1-label" for="time-picker-1">Reminder</label>
<div class="ml-input ml-time-picker-control" role="group" id="time-picker-1" aria-labelledby="time-picker-1-label">
<span class="ml-time-picker-segment" role="spinbutton" tabindex="0" aria-label="Hours" aria-valuemin="0" aria-valuemax="23" aria-valuenow="9" aria-valuetext="09">09</span>
<span class="ml-time-picker-colon" aria-hidden="true">:</span>
<span class="ml-time-picker-segment" role="spinbutton" tabindex="0" aria-label="Minutes" aria-valuemin="0" aria-valuemax="59" aria-valuenow="30" aria-valuetext="30">30</span>
<button class="ml-time-picker-open" type="button" aria-label="Choose from a list" aria-haspopup="dialog" aria-expanded="false"><svg class="mlola-glyph" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--mlola-glyph-stroke, var(--ml-icon-stroke, 1.75))" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true" data-optical-size="default" style="color:var(--mlola-glyph-color, currentColor);scale:var(--mlola-glyph-optical-scale, 1);transform-origin:center"><circle cx="12" cy="12" r="9.5" pathLength="1"></circle><path d="M12 7v5l3 2" pathLength="1"></path></svg></button>
</div>
</div>Classes and attributes
A class names each element; data-* and aria-* attributes carry its variant and state. The values listed are the ones the stylesheet draws; the default needs no attribute.
| Class | Attributes |
|---|---|
ml-time-picker | — |
ml-time-picker-control | data-disableddata-unavailable |
ml-time-picker-segment | data-emptydata-period |
ml-time-picker-colon | — |
ml-time-picker-open | — |
ml-time-picker-list | — |
ml-time-picker-option | aria-selected="true" |
Accessibility and theming
- Semantic elements, accessible names and state relationships are part of the contract.
- Keyboard, pointer and touch paths are operable; focus stays visible in every theme.
- Light and dark modes pass WCAG AA contrast in all 5 canonical themes.
- Reduced motion and forced colors keep meaning and operation.
Dependencies
Installed alongside this component. No third-party UI runtime is ever added.