Design System
Forms

Date picker

Select a single date from a calendar with month and year dropdowns. For a start and end together use Date range picker.

Purpose

A field that opens a calendar. Month and year dropdowns matter more than they look: without them, picking a date of birth means dozens of clicks. For a start and end together use Date range picker.

Example

With a label

The id prop is forwarded to the trigger button, so a Label pairs with it exactly as it would with an input. The picker is controlled — hold the date in state:

Label pairing
const [date, setDate] = React.useState<Date | undefined>();

<div className="grid w-64 gap-1.5">
  <Label htmlFor="dob">Date of birth</Label>
  <DatePicker id="dob" value={date} onChange={setDate} placeholder="Select a date" />
</div>

States

Empty and selected. The empty trigger shows the placeholder in --muted-foreground; a selection renders as a long-form date. There is no disabled state — DatePickerProps exposes no disabled, so omit the control or render the value as text when it cannot be changed.

Structure

PropertyValue
Triggeroutline Button, 40px (h-10), full width, left-aligned
Trigger icon18px calendar_month glyph, --muted-foreground
Placeholder--muted-foreground
Popover--popover surface, --radius-lg, --shadow-8, zero padding
Day cells40px square (size-10), --radius-md
Selected day--primary fill, --primary-foreground text
Today1px --primary border ring
Value formatdate-fns PPP — "6th August 2026"

Best practices

Do

  • Pair the trigger with a Label via the id prop — a calendar icon is not a label.
  • Rely on the month and year dropdowns for far-off dates — they are the default caption.
  • Use the placeholder to say which date is wanted ("Select a start date").

Don't

  • Use two single pickers for a span — that is Date range picker.
  • Leave the default "Pick a date" placeholder when the field means something specific.
  • Reach for a picker when free typing is faster and the format is unambiguous — consider an Input with validation for well-rehearsed dates.

Accessibility & keyboard

  • The trigger is a real button announcing the current value (or placeholder); pair it with a Label via id so the field itself is named.
  • When the popover opens, focus deliberately moves into the calendar grid (the source autoFocus is required — without it keyboard users are stranded on the trigger).
  • The month and year dropdowns are native <select> elements with their own accessible names.
  • Choosing a date closes the popover and returns focus to the trigger.
  • Keyboard: Enter or Space on the trigger opens the calendar; arrow keys move a day (up/down a week) at a time in the grid; Enter or Space selects and closes; Esc closes without selecting.

Props

DatePicker is controlled: pass value and handle onChange, which fires with the new date or undefined when the selection is cleared.

PropTypeDefaultDescription
valueDate | undefined—The currently selected date (controlled).
onChange((date: Date | undefined) => void) | undefined—Called with the new date, or `undefined` when the selection is cleared.
placeholderstring | undefined"Pick a date"Trigger text shown when no date is selected.
idstring | undefined—`id` forwarded to the trigger button, for pairing with a `<Label htmlFor>`.
classNamestring | undefined——

On this page