Skip to content
Slotted

Date Picker

A segmented date field with a calendar behind a trigger, for one calendar date that the reader can type or choose.

mm
dd
yyyy

Type the date or choose it from the calendar.

Installation

The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.

bash
pnpm add @slotted/react @slotted/theme @slotted/themes
tsx
import { DatePicker, DatePickerDefaultsProvider } from '@slotted/react';

Typing or choosing

The field and the calendar write the same value. Type the month, day and year into the segments, or press the calendar button and choose a day; each change reports its reason: keyboard for typing and for the arrow keys in the calendar, pointer for a press on a day, clear for the clear button and blur for a date completed when the field loses focus. A two-digit year resolves through yearPivot: with the default of 20, 30 reads as 2030 and 80 as 1980.

09
30
2026

No change yet.

Sizes

size sets the field and the trigger to one step of the control scale: sm for toolbars and dense tables, md for most forms, lg for sparse forms. Inside a field, an unset size follows the field.

09
01
2026
09
30
2026
11
02
2026

Variants

outline is the default frame. subtle fills the control, for a form on a tinted surface. plain draws no frame at rest, for a table cell or a toolbar, and still shows hover and focus. The calendar button keeps its icon in all three.

09
30
2026
09
30
2026
10
01
2026

States

Set invalid, readOnly and disabled on the field, which passes them to the date picker; each can also be set on the date picker itself. Invalid draws the frame and the focus ring in the danger tone and sets aria-invalid. Read-only keeps the date legible and focusable. Read-only and disabled both disable the calendar button, so the calendar cannot open.

09
28
2026

Error:The delivery date is before the order date, September 30, 2026.

09
30
2026

Set when the order was placed.

10
30
2026

Returns open once the order is delivered.

Earliest and latest dates

min and max bound the field and the calendar together. The calendar disables the days outside the bounds. A date typed outside the bounds stays in the field and marks the date picker invalid, so the reader sees the problem instead of losing what they typed.

10
15
2026

Carriers book October 2026 only.

Unavailable dates

isDateUnavailable receives each date and returns true for a date the reader cannot choose, such as a weekend or a holiday. The calendar disables those days, and a typed unavailable date marks the date picker invalid. Keep the rule in one function and describe it in the field’s description, so the reader knows why a day is refused.

10
13
2026

The Reno dock is closed on weekends and federal holidays.

Locale and format

locale takes a BCP 47 tag and sets the order of the segments, their separators and placeholders, the month and weekday names in the calendar, and the date in words that the calendar button announces. There is no format string: each locale writes its own shape. Unset, the locale comes from SlottedProvider in React or provideSlotted in Angular, and falls back to en-US. The value stays the same PlainDate in every locale.

09
30
2026
30
09
2026
30
09
2026
2026
09
30

First day of the week

The calendar starts the week on the day the locale uses. firstDayOfWeek overrides it with a number from 0, Sunday, to 6, Saturday, for a business whose weeks run differently from its locale.

09
30
2026

Rosters run Monday to Sunday.

Week numbers

weekNumbers adds a column of ISO 8601 week numbers to the calendar. ISO weeks start on Monday, so set firstDayOfWeek to 1 to keep each row inside one numbered week. isoWeekNumber from @slotted/core/date returns the same number for a chosen date.

09
30
2026

Planned for week 40.

Several months

months draws that many months side by side in the calendar, for dates the reader picks weeks ahead. The calendar keeps six rows per month by default (fixedWeeks), so the surface does not change height between months.

10
20
2026

Technicians book up to eight weeks ahead.

Starting view

defaultView opens the calendar on the day, month or year grid. Start on year for a date that is usually years in the past, such as a date of incorporation or a birth date, so the reader does not page back month by month.

mm
dd
yyyy

As printed on the certificate of incorporation.

Placement

The calendar opens below the field, aligned to its start edge. placement takes bottom, top, and either with -start or -end. It is a preference: when the calendar does not fit on that side, it opens on the other.

09
30
2026
09
30
2026

Controlled

Pass value and update it from onValueChange in React, or bind [value] and update it from (valueChange) in Angular, when other parts of the screen depend on the date. The handler receives a PlainDate, or null once the date is cleared. Buttons outside the date picker can set the value; the field and the calendar follow.

10
07
2026

Reminder on Wednesday, October 7, 2026.

An API that carries dates as ISO 8601 text, such as "2026-10-19", converts at the boundary with @slotted/core/date, which also exports the PlainDate type. parseISODate(text) returns a PlainDate or null, toISODate(date) returns 'YYYY-MM-DD', and isPlainDate(value) narrows the CalendarValue the change handler reports.

10
19
2026

The API receives 2026-10-19.

Clearing

clearable adds a clear button to the field while it holds a date, and Clear to the footer of the panel. The button sets the value to null with the reason clear and returns focus to the field. With required, neither is drawn.

10
09
2026

Clear the date to release the shipment.

Shortcuts

presets adds a column of shortcuts beside the calendar, as a list of labels and dates. The panel writes under each label the date it sets, offers Today before them, and adds the twelve months of the year. A value may be a function, which is resolved when the panel draws it, and a shortcut outside the bounds is unavailable. Without presets, the panel is the calendar alone. Here each shortcut sets the date and closes the panel.

09
30
2026

The footer carries a hint and, with clearable, the Clear button. A panel with no hint, no Clear and no Apply draws no footer. footer in React and an element with slDatePickerFooter in Angular replace the hint; a refused date replaces both with the reason. confirm decides when the value changes: off, the default for one date, a press sets it and closes the panel; on, the default for a range and for several dates, the panel keeps a draft that Apply sets and that Escape or a press outside discards. Here confirm keeps one date as a draft.

Plain dates and time zones

The value is a PlainDate, an object with year, month and day and no time or time zone, so the date the reader chose is the date your server receives. toISODate writes it as 2026-09-30, and parseISODate reads it back. timeZone changes one thing: which day the calendar marks as today. Unset, today comes from the browser’s time zone. today states the day itself, such as a business date or a day your server answers: it decides the day marked as today, the Today shortcut and the month an empty panel opens on.

09
30
2026

Today is marked by the date in Auckland.

Value: {"year":2026,"month":9,"day":30}, sent as 2026-09-30

In a form

name adds a hidden input that submits the date as an ISO string, such as 2026-10-14, whether it was typed or chosen. In Angular, the date picker is a form control: formControlName, formControl and ngModel bind the value, Validators.required applies to it, and the date picker reports slottedDateRange for a date outside min and max and slottedDateUnavailable for a refused date. In React, the date stays in your state and you validate it on submit. Submit without a date to see the required error, type a date in September to see the bound error, then reset.

mm
dd
yyyy

Error:

Keyboard and the trigger’s name

Alt+ArrowDown opens the calendar from the field; Enter or Space on the calendar button opens it too. Opening moves focus to the chosen day, or to today when no date is set, and Tab and Shift+Tab cycle through the shortcuts, the calendar and the footer until the panel closes. Ctrl+Enter applies a draft. The arrow keys move between days, PageUp and PageDown move by a month, Shift with either moves by a year, and Enter or Space chooses the focused day. Escape closes the calendar and returns focus to the calendar button; while the calendar shows the month or year grid, Escape first returns to the day grid. The calendar button’s accessible name carries the chosen date, so a screen reader announces it when focus returns. messages replaces that name: choose while no date is set and change, with the date in its {date} slot, once one is. onOpenChange in React and (openChange) in Angular report why the calendar opened or closed.

09
30
2026

Focus the field and press Alt+ArrowDown.

Narrow screens

Under 480 pixels on a touch screen, the calendar opens as a modal sheet that slides up from the bottom of the viewport over a scrim, instead of a popover under the field. A press on the scrim, Escape, the platform’s way back or a pull on the grip closes it, and focus returns to the trigger. Under 760 pixels, on any screen, the panel is one column: one month, and the shortcuts in a row above the footer. The positioner carries data-presentation="sheet" for the sheet.

mm
dd
yyyy

Focus and open from code

The date picker’s handle has focus(), which puts focus on the first segment of the field, and open() and close() in React, named openSurface() and closeSurface() in Angular. Opening from code moves focus into the calendar, as the calendar button does. Reach it with ref in React and #picker="slDatePicker" in Angular, for a button elsewhere on the screen that starts an edit.

03
31
2027

Defaults for a section

DatePickerDefaultsProvider in React and provideDatePickerDefaults in Angular set size, variant, placement, confirm, timeZone, today and calendar once for every date picker under them, such as a filter panel. A value set on one date picker still wins.

09
01
2026
10
31
2026

Ship date in business days

The earliest ship date is two business days after the order, weekends and holidays are unavailable, and the latest date is forty business days out. One isBusinessDay function feeds isDateUnavailable and the count in the description, so the calendar and the text agree.

10
02
2026

Ships Friday, October 2, 2026, 2 business days after the order.

Invoice due date from payment terms

The due date follows the invoice date and the payment terms: Net 30 adds 30 days to the invoice date with addDays. The due date is a read-only date picker with a controlled value, so the reader sees the date in the same format as the invoice date and cannot edit it.

09
30
2026
10
30
2026

Payment is due Friday, October 30, 2026.

Report date with closing shortcuts

A balance sheet runs as of one closing date. Shortcuts offer the closing dates finance uses most, and max stops the reader at today. For a report period with a start and an end, use the date range picker instead.

08
31
2026

Balances close at the end of Monday, August 31, 2026.

Accessibility

KeyEffectFocus
Alt+ArrowDownopen—
Escapeclosetrigger
Tabcontained—
  • The trigger says aria-haspopup="dialog" and its name carries the value written, which is where focus returns when the panel closes.
  • The panel is a dialog with its Tab wrapped, and each grid inside it is one stop.
  • Escape discards the draft and returns focus to the trigger. Ctrl+Enter applies from anywhere in the panel.
  • The footer’s hint is a status region, so the reason Apply is off is spoken as well as drawn.
  • Alt+ArrowDown opens the panel and takes focus to the chosen day.
  • Escape walks the calendar’s view down before it closes the panel, so a reader in the years is not thrown out of it.

API

DatePicker

Props

valuePlainDate | DateRange | PlainDate[] | null
The value held, which depends on selectionMode. Present means the consumer owns it. Under granularity="month", a PlainYearMonth.
defaultValuePlainDate | DateRange | PlainDate[] | nullDefault null
What it starts from, and returns to on a form reset. Read once.
granularity'day' | 'month'Default day
What a choice is.
selectionMode'single' | 'range' | 'multiple'Default single
How many dates the value holds.
monthsnumberDefault 1
How many months the panel shows. One below 760 pixels.
defaultView'day' | 'month' | 'year'Default day
The view the calendar opens on.
minPlainDate
The earliest accepted date.
maxPlainDate
The latest accepted date.
isDateUnavailable(date: PlainDate) => boolean
Refuses particular dates.
presetsreadonly PickerPreset<CalendarValue>[]
The consumer’s own shortcuts, after Today. Without any, the panel is the month alone.
confirmbooleanDefault off for one date
Whether the panel keeps a draft until Apply.
weekNumbersbooleanDefault false
Draws the ISO week number; in a run, a press on it chooses the week.
fixedWeeksbooleanDefault true
Six rows whatever the month needs, with one month.
firstDayOfWeeknumberDefault the locale’s
0 is Sunday.
yearPivotnumber
How a two-digit typed year resolves.
calendar'gregory'Default gregory
The calendar system.
namestring
The name a form posts the date under.
invalidboolean
Stated by the consumer; a refused date is invalid without it.
openboolean
Whether the panel is showing. Present means the consumer owns it.
defaultOpenbooleanDefault false
Whether it starts open when nobody else says. Read once.
placement'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end'Default bottom-start
Where the panel opens, before the positioner has read the room.
size'sm' | 'md' | 'lg'Default md
The height of the control. The field around it answers when the picker does not.
variant'outline' | 'subtle' | 'plain'Default outline
How the control draws its frame.
localestringDefault the language in force
BCP 47. Writes the field, the panel and the trigger’s name.
timeZonestringDefault the runtime’s
Which zone answers "what is now".
todayPlainDateDefault the clock’s
The day it is: the mark of today, Today, and the month an empty panel opens on.
disabledboolean
Answers no key and no press.
readOnlyboolean
Readable and not changeable.
requiredboolean
The form needs a value.
clearablebooleanDefault false
Draws a clear on the control and in the panel, unless required.
messagesPartial<DatePickerMessages>
Words laid over the language in force: the trigger’s two names, and what is said of a refused date.

Events

NamePayloadWhen
onValueChange(value: CalendarValue, request: ChangeRequest<CalendarValue>)Before the value moves, and cancellable: from a key in the field, from a press, from Apply, from Clear.
onOpenChange(open: boolean, request: ChangeRequest<boolean>)Before the panel opens or closes, with the reason.

Composition

DatePickerDefaultsProvidercomponent
On applicationSets calendar, confirm, placement, size, timeZone, today and variant once.
footerReactNodeDefault the page keys
What the footer says when nothing is wrong.
render(props: DatePickerRootProps) => ReactNode
Substitutes the element the root renders.
refRef<DatePickerHandle>
focus(), open() and close().

Parts

PartElementRequiredPurpose
rootdiv, or the element render returnsYesThe frame of the picker. Carries data-ui="date-picker", data-size, data-variant, data-calendar, data-open and the state attributes.
controldivYesThe box the panel hangs from, around the field and the trigger.
triggerbuttonYesThe button that opens the panel. It says aria-haspopup="dialog", and its name carries the date written.

Theming

Each token is a CSS custom property: set it in a theme, or on any element to retune every date picker inside it.

Date Picker tokens

TokenDefault
--slotted-date-picker-invalid-focus-ring-colorvar(--slotted-focus-ring-color-invalid, Highlight)
--slotted-date-picker-radiusvar(--slotted-control-radius, 4px)
--slotted-date-picker-trigger-active-backgroundvar(--slotted-tone-secondary-subtle-active)
--slotted-date-picker-trigger-colorvar(--slotted-text-muted, GrayText)
--slotted-date-picker-trigger-hover-backgroundvar(--slotted-tone-secondary-subtle-hover)
--slotted-date-picker-trigger-sizemin( calc(var(--_icon-size) + 2 * var(--slotted-space-2, 0.25rem)), calc( var(--_height) - var(--slotted-control-border-width, 1px) * 2 - var(--slotted-space-2, 0.25rem) ) )

Theme tokens it reads

TokenDefault
--slotted-control-border-widthvar(--slotted-border-width-thin)
--slotted-control-height-lgcomfortable 38px · compact 32px · dense 30px
--slotted-control-height-mdcomfortable 34px · compact 28px · dense 26px
--slotted-control-height-smcomfortable 30px · compact 26px · dense 24px
--slotted-control-icon-size-lgcomfortable 18px · compact 16px · dense 14px
--slotted-control-icon-size-mdcomfortable 16px · compact 14px · dense 13px
--slotted-control-icon-size-smcomfortable 14px · compact 13px · dense 12px
--slotted-control-radiusvar(--slotted-radius-sm)
--slotted-control-transition-durationvar(--slotted-duration-short)
--slotted-control-transition-easingvar(--slotted-easing-standard)
--slotted-disabled-foregroundSet per scheme by the theme
--slotted-focus-ring-colorSet per scheme by the theme
--slotted-focus-ring-color-invalidSet per scheme by the theme
--slotted-focus-ring-offsetvar(--slotted-border-width-thick)
--slotted-focus-ring-widthvar(--slotted-border-width-thick)
--slotted-space-20.25rem
--slotted-target-comfortable44px
--slotted-target-min24px
--slotted-text-mutedSet per scheme by the theme
--slotted-tone-secondary-subtle-activeSet per scheme by the theme
--slotted-tone-secondary-subtle-hoverSet per scheme by the theme