Skip to the page
Supply UI

Date picker

In code: DatePicker

A field to type a date in, with a calendar to pick it from. The value is "YYYY-MM-DD"; mode="range" gives a field for each end and the value [start, end]. On a phone the calendar comes up as a sheet (presentation="auto"). name sends it with the form.

Preview

Use

The code of the preview above
import { DatePicker, Field, Stack } from '@/components/ui';

<Stack>
  <Field label="Delivery">
    <DatePicker defaultValue="2026-11-26" locale="en-GB" weekStartsOn={1} clearable />
  </Field>
  <Field label="Stay">
    <DatePicker mode="range" defaultValue={['2026-12-18', '2026-12-22']} locale="en-GB" weekStartsOn={1} />
  </Field>
</Stack>

This page as text, for an AI

Options

OptionTypeWhat it does
aria-label stringDefines a string value that labels the current element.
className stringMore classes on the outer element, for layout around it (margins, grid placement), not to restyle it.
clearable booleanA button that empties the field.
defaultValue null | string | [string, string]The value it starts with, when it keeps its own state (uncontrolled).
endLabel stringIn range mode: the end field's name for screen readers; "End date" (in the app's language) by default.
endPlaceholder stringIn range mode: shown while the end field is empty.
id stringIts id, for a <label htmlFor> or aria-labelledby elsewhere.
marked string[]Days with something on them: they get a dot. "YYYY-MM-DD".
mode "single" | "range"What is chosen: single (default), one day, or range, a start and an end ([start, end]) in two fields.
months numberHow many months show side by side.
onValueChange (value: string) => void | (value: [string, string] | null) => voidRuns with the new choice, in the shape mode gives: the day (an empty string when it is cleared) or [start, end].
placeholder stringShown while the field is empty. In range mode, for the start.
presets { label: ReactNode; value: PickerValue; }[]Ready-made choices under the calendar: "Today", "Last 7 days". The tool works out the dates.
selects booleanDropdowns for the month and the year instead of the title: for a birthday, or any date far from today.
value null | string | [string, string]The current value, when your state holds it (controlled); use with onValueChange.

It also takes the 311 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.

Without React

The same look on any HTML, with the classes (React only; plain HTML uses input[type=date]).

With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:

components/button.csscomponents/card.csscomponents/table.csscomponents/tabs.csscomponents/popups.csscomponents/dialog.csscomponents/icons.csscomponents/input-group.csscomponents/calendar.csscomponents/button-group-toggle.csscomponents/code-input.csscomponents/tab-bar.csscomponents/command-palette.csscomponents/prose.csscomponents/carousel-arrows.csscomponents/page-transitions.cssparts/carousel.cssparts/calendar.cssparts/date-time-typed-part.cssparts/listbox.cssparts/date-picker.cssparts/board.css

In the examples

Small screens made with it and the rest of the kit. They work: click, type and choose in them.

Veg box, largeEvery other Thursday
Arrives 2026-11-26, morning
When the box comes Type or pick the day, then the part of it

Actions and forms: states, do and don’t

A field to type a date in, with a calendar to pick it from; a sheet on a phone. mode="range" gives a field for each end. presets are ready choices under the calendar: [{ label: 'Today', value: '2026-11-15' }].

States. Every control has rest, hover, pressed, focus (a ring, from the keyboard only), disabled and, where it applies, chosen (data-checked, aria-pressed) and invalid (aria-invalid, with the message under the field). Each change of look fades with --ui-dur-fast.

Do

  • Give every field a visible label (Field label=…); a placeholder is an example, never the label.
  • Keep one primary button per view; deleting is danger and asks first with AlertDialog.
  • Say what went wrong under the field, in words a person can act on ("Enter a full email address").
  • Use NumberInput, DatePicker, Select and the rest rather than a bare <input>: they bring the keyboard, the screen-reader names and the phone layout.

Don't

  • Don't disable a button to say a form is incomplete without saying why next to it.
  • Don't put two primary buttons side by side, or a primary button inside a menu.
  • Don't use a Switch for something that only happens when a form is sent: that is a Checkbox.