Skip to content
GitHub (opens in a new tab)

DatePicker

Form field that opens a month grid to pick one date.

stableMoleculecontracts/datepicker.json

Preview

DatePicker

Form field that opens a month grid to pick one date. Sizes sm, md and lg match Input. Wrap with Field. For a range use DateRangePicker. Not a native date input. Not the event Calendar.

Master

Trigger shows the chosen day in Geist Mono. The overlay has the shared header (icon, the picked day, Choose date, Close) above the month grid. Today has a bar under the number. Escape, Close or a click outside closes it.

Usage

Use DatePicker in a form. Use Calendar for a schedule of events. Value is YYYY-MM-DD. Do not invent Popover or a native date input. A start and end date is DateRangePicker; mode="range" is deprecated.

Do's

  • A date in a form or filter
  • Need a typed-looking field whose overlay is a month grid

Don'ts

  • A schedule of events — use Calendar
  • A range of dates, with or without presets — use DateRangePicker (mode range is deprecated)
  • Time-only — ask first
<DatePicker
  id="start-date"
  size="md"
  value="2026-08-29"
  onValueChange={(date) => setDate(date)}
/>

When to use

  • A date in a form or filter
  • Need a typed-looking field whose overlay is a month grid

When not to use

  • A schedule of events — use Calendar
  • A range of dates, with or without presets — use DateRangePicker (mode range is deprecated)
  • Time-only — ask first

What an agent reads

import { DatePicker } from "agentic-ds-kit";
must
  • error shows the danger border and Field's error text via aria-describedby; no aria-invalid on the trigger button (button does not support it)
  • Trigger is a button with aria-haspopup=dialog, aria-expanded, aria-controls
  • Overlay is role=dialog aria-modal labelled Choose date (or Choose dates in range) and contains DatePicker’s own month grid
  • Overlay header is the shared overlay header: CalendarDays icon and the picked date (or the placeholder) as the eyebrow, the Choose date title, and a Close button named by the close label
  • Opening focuses the picked day (else today), not Close. Arrows move by day and week, Home and End to the week's first and last day (weekStart), Page Up and Page Down by month
  • Today has a short bar under the number and is named today. Unavailable days are struck through, not only faded, and named unavailable
  • Range: first click sets start, second click sets end and closes. Escape discards an in-progress range
  • Tab stays in the overlay; Escape, Close and pointer down outside close and return focus to the trigger. Escape closes only the newest open overlay (the shared Escape stack), not a parent Modal, Drawer or AlertDialog
  • Month-grid overlay is at least as wide as the trigger and anchors to its end, growing toward the start edge when the trigger is narrower than the grid, so it fits in drawers without horizontal scroll. When that would cross the start edge of the window or of a clipping container it anchors to the trigger's start instead
  • Must have associated label via Field or a visible label pointing at id
  • error described by Field via describedBy
  • built-in labels (previousMonth, nextMonth, chooseDate, chooseDates, close) come from KitLabelsProvider; English by default
defaults
  • mode single
  • size md
  • placeholder Pick a date
  • disabled false
  • error false
  • weekStart 0
stops if
  • Do not wrap DatePicker in Popover. The field owns its overlay. Do not invent a local calendar, DatePickerDialog, PeriodPicker, DualCalendar, or native input type=date
  • Named presets such as This month or Last 30 days — use DateRangePicker
  • Do not use two DatePickers for start and end, and do not use mode=range for new work (deprecated) — use DateRangePicker
  • Do not use the event Calendar as a date field
  • Do not add built-in label, hint, error text, help, or hideLabel — wrap with Field
  • Do not add time or Density, and no size past lg
  • Do not use raw hex

From contracts/datepicker.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
idstringYes—For Field htmlFor
modesingle | rangeNosinglesingle is one YYYY-MM-DD. range ({ start, end? }) is deprecated: it still works, with a warning in development. Use DateRangePicker, with presets={[]} for the month grid only.
valuestring | { start: string, end?: string }No—controlled. string when single; { start, end? } when range. YYYY-MM-DD.
defaultValuestring | { start: string, end?: string }No—uncontrolled. string when single; { start, end? } when range.
onValueChangefunctionNo—(date: string) => void when single; (range: { start, end?: string }) => void when range
sizemd | sm | lgNomdTrigger height sm 32, md 36, lg 40, like Input. The overlay month grid is sm when size is sm, else md.
placeholderstringNoPick a dateDefaults to Pick a date, or Pick dates when mode is range
disabledbooleanNofalse—
errorbooleanNofalse—
minDatestringNo—Passed to the overlay month grid
maxDatestringNo—Passed to the overlay month grid
weekStartenumNo0First day of the week: 0 Sunday, 1 Monday. Moves the weekday row and Home/End.
isDateDisabledfunctionNo—(date: string) => boolean. Turns single days off, like holidays or weekends. Those days, and days outside minDate/maxDate, are struck through and named unavailable.
namestringNo—Hidden input for forms. Range submits start/end, like 2026-08-10/2026-08-18
describedBystringNo—Field wires hint and error ids onto the trigger
  • Component
    →

    Calendar

    A full calendar of events by month, week, day, or list.

  • Component
    →

    DateRangePicker

    Pick a date range from named presets such as This month or Last 30 days, from two months side by side, or by typing the start and end, then Apply.

  • Component
    →

    DateTimePicker

    Pick a calendar date and a time in one field.

  • Component
    →

    DataGrid

    An editable table: people click a cell to add or change its content, like rule conditions, line items, or mappings.