UI componentsdocs/ui/components/pickers.md

Date, time & colour

Pick dates, times and colours.

← Component reference

Date pickers #

Dates, ranges, months and years.

DatePicker #

Trigger + calendar dropdown. Opening focuses the active day; picking a day or Escape closes and returns focus to the trigger.

Due date
function Example() {
    const due = signal("2026-09-29");
    return <DatePicker value={due()} onChange={due.set} label="Due date" />;
}

Slots: root calendar dropdown label trigger value

PropTypeRequiredDefaultDescription
isDateDisabled(iso: string) => booleanReturn true for days that can't be picked (YYYY-MM-DD).
labelstringVisible label, linked to the trigger.
localestringBCP 47 locale for month / day labels (default: runtime locale).
maxstringLatest selectable date, YYYY-MM-DD.
minstringEarliest selectable date, YYYY-MM-DD.
onChange(iso: string) => voidCalled with the picked day as YYYY-MM-DD.
placeholderstringTrigger text while no day is picked.
valuestringSelected day, YYYY-MM-DD (controlled).
weekStartsOnWeekdayFirst column: 0 = Sunday (default) … 6 = Saturday.

Weekday

type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;

DateRangePicker #

Two-step date range picker (start → end).

function Example() {
    const range = signal<DateRange>({ start: "2026-10-05", end: "2026-10-09" });
    return <DateRangePicker placeholder="Select dates" value={range()} onChange={range.set} />;
}

Slots: root cell dropdown summary trigger

PropTypeRequiredDefaultDescription
onChange(range: DateRange) => voidyesCalled after each pick: first with start only, then with both ends.
valueDateRangeyesSelected range (controlled).
placeholderstring"Pick date range"Trigger text when nothing is picked.

DateRange

FieldTypeRequiredDescription
startstringFirst day, YYYY-MM-DD.
endstringLast day, YYYY-MM-DD (unset while the second click is pending).

DateInput #

Native date field; forwarded attributes land on the <input>.

function Example() {
    const date = signal("2026-10-01");
    return <DateInput aria-label="Start date" value={date()} onChange={date.set} />;
}
PropTypeRequiredDefaultDescription
onChange(value: string) => voidyesCalled with the new value in the native format.
valuestringyesValue in the native format: YYYY-MM-DD (date) or HH:MM (time).
disabledbooleanDisables the field.
invalidbooleanMarks the value invalid (aria-invalid and error styling).
namestringField name submitted with the form.

Calendar #

Month grid (WAI-ARIA date grid): one tab stop, ← → ↑ ↓ by day/week, PageUp/PageDown by month (Shift = year), Home/End week edges, full-date labels, aria-selected / aria-current="date", min / max / isDateDisabled.

September 2026
SuMoTuWeThFrSa

Selected: 2026-09-29

function Example() {
    const date = signal("2026-09-29");
    return (
        <Stack gap="0.5rem">
            <Calendar value={date()} onChange={date.set} />
            <Text muted>Selected: {date()}</Text>
        </Stack>
    );
}

Slots: root cell day grid header label nav row table weekday weekdays

PropTypeRequiredDefaultDescription
autoFocusbooleanFocus the active day on mount (used by DatePicker).
isDateDisabled(iso: string) => booleanReturn true for days that can't be picked (YYYY-MM-DD).
localestringBCP 47 locale for month / day labels (default: runtime locale).
maxstringLatest selectable date, YYYY-MM-DD.
minstringEarliest selectable date, YYYY-MM-DD.
onChange(iso: string) => voidCalled with the picked day as YYYY-MM-DD.
valuestringYYYY-MM-DD
weekStartsOnWeekday0First column: 0 = Sunday (default) … 6 = Saturday.

Weekday

type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;

MonthPicker #

Month/year picker.

2026

Selected: 2026-10

function Example() {
    const month = signal("2026-10");
    return (
        <>
            <MonthPicker value={month()} onChange={month.set} />
            <Text muted>Selected: {month()}</Text>
        </>
    );
}

Slots: root cell grid header title

PropTypeRequiredDefaultDescription
monthLabelsstring[]Month labels (default English short names).
onChange(ym: string) => voidCalled with the picked month as YYYY-MM.
valuestringYYYY-MM

YearPicker #

Twelve-year grid with paging.

2020–2031

Selected: 2026

function Example() {
    const year = signal(2026);
    return (
        <>
            <YearPicker value={year()} onChange={year.set} />
            <Text muted>Selected: {year()}</Text>
        </>
    );
}

Slots: root cell grid header title

PropTypeRequiredDefaultDescription
onChange(year: number) => voidCalled with the picked year.
valuenumberSelected year.

Also accepts the shared props: pass-through attributes, class, style, classes, styles, unstyled.

Time pickers #

Times of day.

TimeInput #

Native time field; forwarded attributes land on the <input>.

function Example() {
    const time = signal("09:30");
    return <TimeInput aria-label="Start time" value={time()} onChange={time.set} />;
}
PropTypeRequiredDefaultDescription
onChange(value: string) => voidyesCalled with the new value in the native format.
valuestringyesValue in the native format: YYYY-MM-DD (date) or HH:MM (time).
disabledbooleanDisables the field.
invalidbooleanMarks the value invalid (aria-invalid and error styling).
namestringField name submitted with the form.

TimePicker #

Hours/minutes picker.

09:30

Selected: 09:30

function Example() {
    const time = signal("09:30");
    return (
        <>
            <TimePicker value={time()} onChange={time.set} />
            <Text muted>Selected: {time()}</Text>
        </>
    );
}

Slots: root cell column header value

PropTypeRequiredDefaultDescription
minutesStepnumber5Minute options' interval.
onChange(time: string) => voidCalled with the picked time as HH:MM.
valuestring"12:00"HH:MM

Also accepts the shared props: pass-through attributes, class, style, classes, styles, unstyled.

Colour #

Colour inputs, pickers and swatches.

ColorInput #

Color swatch + hex text field. The text <input> is the host; classes.root styles the wrapper.

function Example() {
    const color = signal("#4f46e5");
    return <ColorInput aria-label="Brand colour" value={color()} onChange={color.set} />;
}

Slots: root input swatch

PropTypeRequiredDefaultDescription
onChange(value: string) => voidyesCalled with the new colour (typed or picked).
valuestringyesColour as hex, e.g. #4f46e5 (controlled).
disabledbooleanDisables the field and swatch.
invalidbooleanMarks the value invalid (aria-invalid and error styling).
namestringField name submitted with the form.
swatchLabelstring"Color"Accessible name for the swatch picker (default "Color").

ColorPicker #

Native color input + swatches.

#1e87f0

Selected: #1e87f0

function Example() {
    const color = signal("#1e87f0");
    return (
        <Stack gap="0.5rem">
            <ColorPicker value={color()} onChange={color.set} />
            <Text muted>
                Selected: <code>{color()}</code>
            </Text>
        </Stack>
    );
}

Slots: root native swatch swatches value

PropTypeRequiredDefaultDescription
onChange(color: string) => voidyesCalled with the picked colour.
valuestringyes""Selected colour (controlled), e.g. #1e87f0.
swatchesstring[]Preset colours shown as swatches.

ColorSwatch #

Color chip; renders a <button> when onClick is set (use selected for a picker).

Brand colour: #fca311

function Example() {
    const brand = signal("#fca311");
    const colors = ["#fca311", "#14213d", "#e11d48", "#047857", "#7c3aed", "#0ea5e9"];
    return (
        <Stack gap="0.5rem">
            <Group gap="0.5rem">
                <For each={colors}>
                    {(color) => (
                        <ColorSwatch
                            color={color}
                            selected={brand() === color}
                            onClick={() => brand.set(color)}
                        />
                    )}
                </For>
            </Group>
            <Text muted>
                Brand colour: <code>{brand()}</code>
            </Text>
        </Stack>
    );
}
PropTypeRequiredDefaultDescription
colorstringyesAny CSS colour.
childrencontentContent inside the swatch (replaces the check mark when selected).
labelstringAccessible name (default Color <color>).
onClick(e: MouseEvent) => voidMakes the swatch a button; called when it is pressed.
selectedbooleanMarks the chosen swatch (ring + check; aria-pressed when clickable).
sizenumber28Diameter in pixels.
withShadowbooleanAdds a soft drop shadow.

Also accepts the shared props: pass-through attributes, class, style, classes, styles, unstyled.