Skip to main content

DatePicker

A labelled date field that opens a Calendar popover; accepts Dates or ISO strings. @startingPoint section="Date & time" subtitle="Date field with calendar popover" viewport="320x120"

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

A labelled date field that opens a Calendar popover; accepts Dates or ISO strings.

Accessibility​

Keyboard-navigable grid (arrow keys move days, PageUp/PageDown move months). The selected date is announced; the field has a clear label.

Install and import​

npx shadcn@latest add @prism/date-picker
import { DatePicker } from '@/components/prism/DatePicker';

In a no-build prototype, read it from the bundle instead: const { DatePicker } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
labelReact.ReactNode—
descriptionReact.ReactNode—
valueT | null—Controlled value: a Date or "YYYY-MM-DD"; null for none.
defaultValueT | null—Initial value (uncontrolled): a Date or "YYYY-MM-DD".
onChange(date: T | null) => void—Fired with the chosen date in the same form as value/defaultValue (or as valueFormat says), and null when cleared.
valueFormat"iso" | "date"—Force onChange's type: "iso" ("YYYY-MM-DD") or "date". Default: ISO if any date prop (value, defaultValue, minDate, maxDate, defaultFocusedValue) is a string, else Date. Set it when the field starts empty with no other date prop.
placeholderstring—
minDateDateInput—
maxDateDateInput—
defaultFocusedValueDateInput—The month the calendar opens on when there's no value (e.g. "2008-01-01" for a birth date).
showMonthYearPickerboolean—Month and year selects in the calendar header. Default true.
localestring—BCP 47 locale. Formats the shown date (default "en-GB": fixed, so server and browser render the same text) and, when set, gives the calendar that locale's month names, weekday names and first day of the week.
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 6—First day of the week in the calendar, 0 (Sunday) to 6 (Saturday). Default: the locale's own when locale is set, otherwise Monday.
formatOptionsIntl.DateTimeFormatOptions—Intl.DateTimeFormat options for the shown date. Default { year: "numeric", month: "short", day: "numeric" }.
isClearableboolean—Show a × that clears the value (onChange(null)).
isRequiredboolean—Blocks native form submit while empty.
isInvalidboolean—
errorMessageReact.ReactNode—Shown (and announced) when isInvalid.
namestring—Form field name: the ISO date submits natively.
formstring—Id of the form to submit with, when the picker sits outside it.
isDisabledboolean—
isLabelHiddenboolean—Keep label for screen readers only (e.g. a date shown between ‹ › day arrows).
idstring—Names the field when there is no label; the chosen date is read after it.
width"xs" | "sm" | "md" | "lg" | "full"—Maximum width: "xs" (8rem) | "sm" (12rem) | "md" (20rem) | "lg" (36rem) | "full" (default). A cap, not a fixed width — it still shrinks on a phone or in a narrow FormRow column; the label and messages follow it. Sizes are the --field-width-* tokens.
classNamestring—