Aliases
calendar picker
components / datepicker
Single-date field and calendar surface with blocked dates, honest keyboard travel, and date-only values.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
calendar picker
Explore the math
Type and Scale,Contrast and Distinctness,Proof System,Layout and Composition
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
field wrapper
rootProvides the field label, helper text, and validation state.
field button
triggerOpens the calendar surface and displays the chosen date.
date grid surface
calendarAnchored calendar surface with month navigation.
grid cell button
daySelectable calendar day with range and disabled rules.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
label | string | — | Visible label used for the field or control. |
description | string | — | Supporting helper copy rendered below or beside the main label. |
error | string | — | Validation or problem copy rendered in the error slot when present. |
placeholder | string | — | Placeholder text shown before a user makes a selection or enters text. |
required | boolean | false | Marks the field or control as required for form semantics and docs examples. |
disabled | boolean | false | Disables interaction and exposes the correct non-interactive semantics for the control. |
name | string | — | Form field name used for native form submission. |
id | string | — | Optional id used to bind external labels or descriptions to the component. |
size | 'sm' | 'md' | 'lg' | 'md' | Chooses the compiled size recipe for the component. |
value | string | — | Controlled date-only value in `YYYY-MM-DD` format. |
min | string | — | Minimum selectable date in `YYYY-MM-DD` format. |
max | string | — | Maximum selectable date in `YYYY-MM-DD` format. |
disabledDates | string[] | — | Explicitly blocked date-only values. |
weekStartsOn | 0 | 1 | 0 | Chooses Sunday or Monday as the first day of the week. |
onChange | (detail: { value: string | undefined }) => void | — | Callback fired when a valid date is selected. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
change | { value: string | undefined } | Fires when the component commits a new value. |
Slots
| Name | Description |
|---|---|
default | DatePicker is prop-driven in v1 and does not expose custom slots. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Caveats
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: choose one launch dateA standard single-date field with a selected value.
Copy snippet
<DatePicker label="Launch date" value="2026-04-15" />Common patterns
1 example
common
Common: min and max constraintsLimit the valid date window when the workflow has a real schedule boundary.
Copy snippet
<DatePicker label="Ship date" min="2026-04-01" max="2026-04-30" />Edge cases
1 example
edge
Edge: blocked datesBlock specific non-working days or unavailable release slots.
Copy snippet
<DatePicker label="Launch date" disabledDates={['2026-04-19', '2026-04-20']} />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
size=md
size=lg
size=sm