Date Picker
A date field that opens a calendar, for one date or a range with presets, shown in the reader's format and stored as ISO.
Rendering Date 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 date-pickerUsage
import { DatePicker } from "@/components/ui/date-picker";
export default function Example() {
return <DatePicker label="Start date" defaultValue="2026-09-18" today="2026-09-14" clearable />;
}Styling comes from the engine stylesheet and the nearest theme. Set it once at the root:
<html data-theme="graphite" data-mode="light">Examples
A range with presets
Presets cover the common ranges; the calendar covers the rest.
Rendering A range with presets…
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-date-picker">
<label class="ml-input-label" id="date-picker-1-label" for="date-picker-1">Start date</label>
<div class="ml-date-picker-control">
<button class="ml-input ml-date-picker-trigger" id="date-picker-1" type="button" aria-haspopup="dialog" aria-expanded="false"><svg class="mlola-glyph ml-date-picker-icon" 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"><rect x="3" y="5" width="18" height="16" rx="2" pathLength="1"></rect><path d="M8 3v4M16 3v4M3 10h18" pathLength="1"></path></svg><span class="ml-date-picker-value">Sep 18, 2026</span></button>
<button class="ml-date-picker-clear" type="button" data-hit="expand" aria-label="Clear date"><svg class="mlola-glyph" width="0.9em" height="0.9em" 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"><path d="M18 6 6 18M6 6l12 12" pathLength="1"></path></svg></button>
</div>
</div>Options
| Prop | Values | Default |
|---|---|---|
mode | singlerange | — |
Every prop with a fixed set of values, read from the exported TypeScript types with its doc comment. Open the Code tab above for the rest of the API.
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-date-picker | — |
ml-date-picker-control | — |
ml-date-picker-trigger | data-empty |
ml-date-picker-value | — |
ml-date-picker-icon | — |
ml-date-picker-clear | — |
ml-popover | data-side="bottom | left | right | top" |
ml-date-picker-popover | — |
ml-date-picker-panel | data-presets |
ml-date-picker-presets | — |
ml-date-picker-preset | — |
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.