Date picker

A date field with a calendar dropdown, and the calendar on its own. Keyboard grid navigation, min/max, locale-aware. Form-associated.

Source on GitHub

Pick a day.
Full width: the days share the width of the container
Code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-date-picker>

Values are ISO dates ("2026-10-06"), submitted as such. ArrowDown on the field opens the calendar; Escape closes it. On a touch screen the trigger opens the system's picker instead (native).

PropertyAttributeTypeDefaultDescription
valuevaluestringThe chosen date, ISO "YYYY-MM-DD" ("" for none). The value attribute is the initial value (restored on form reset).
minminstringEarliest selectable date (ISO). Earlier days are disabled; an earlier value is invalid (rangeUnderflow).
maxmaxstringLatest selectable date (ISO).
placeholderplaceholderstringPick a date (text date-picker.placeholder)Shown while no date is chosen.
formatformatshort | medium | long | fullmediumHow the date is displayed (Intl dateStyle).
localelocalestringLocale for names and formats. Default: the nearest lang attribute, else the browser's.
firstDayfirst-daynumberFirst day of the week, 0 (Sunday) to 6. Default: the locale's.
clearableclearable reflectsbooleanShows a button that clears the date.
openopen reflectsbooleanThe calendar dropdown is shown.
nativenative reflectsauto | always | neverautoWhich picker the trigger opens: the system's (the native date input's, the usual one on a phone) or the calendar dropdown. auto: the system's on a touch screen (pointer: coarse), else the calendar. A date picked in the system's picker is the value like one picked in the calendar.
namename reflectsstringForm field name.
labellabelstringVisible label (also the accessible name).
descriptiondescriptionstringHelp text.
descriptionPositiondescription-position reflectsabove | belowaboveThe description before the control (help first) or after it, with the error (fields in a row stay aligned).
errorerrorstringError text.
requiredrequiredbooleanRequired for form submission.
disableddisabledbooleanNot interactive nor submitted.
sizesize reflectsxs | sm | md | lg | xlsmHeight and font size.
radiusradiusxs | sm | md | lg | xl | fullCorner radius.
variantvariant reflectsdefault | filled | unstyleddefaultBox style.
EventDescription
inputWhen the date changes (picked or cleared).
changeWhen the date changes (picked or cleared).
ray-openThe calendar opened.
ray-closeThe calendar closed.
PartDescription
triggerThe button showing the date.
clearThe clear button.
dropdownThe calendar panel (a popover in the top layer).
calendarThe <ray-calendar> in the dropdown (its day, day-selected, day-today, day-outside, day-disabled, caption, nav and grid parts are exported).
inputThe hidden native <input type=date> that holds the value (the model).
wrapperThe box.

<ray-calendar>

WAI-ARIA grid: arrows move by day and week, Home/End to the week's ends, PageUp/PageDown by month (with Shift, by year), Enter/Space select.

PropertyAttributeTypeDefaultDescription
valuevaluestringThe selected date, ISO "YYYY-MM-DD".
minminstringEarliest selectable date (ISO).
maxmaxstringLatest selectable date (ISO).
localelocalestringLocale for month and weekday names. Default: the nearest lang attribute, else the browser's.
firstDayfirst-daynumberFirst day of the week, 0 (Sunday) to 6. Default: the locale's.
sizesize reflectsxs | sm | md | lg | xlsmDay cell size and font size.
fullWidthfull-width reflectsbooleanFills the width of its container: the columns share it and the days grow square, up to --ray-calendar-max-cell (default 1.5 times the size's cell), then wider than tall. Without it the calendar takes its size's width and shrinks when its container is narrower.
dayState—functionMarks days: called with each day's ISO date on every render, it returns a state name (letters, digits, - and _; not selected, today, outside nor disabled, the calendar's own parts) or nothing. The day button gets data-state and the part day-<state>, so ::part(day-taken) (or ::part(day-missed)::after for a dot) styles it from outside. Call refresh() when what it marks changed but the month did not.
EventDescription
changeA day was selected (read `value`).
PartDescription
headerThe row with the month and the navigation buttons.
captionThe month and year.
navThe previous/next month buttons.
gridThe day grid (role=grid).
dayEach day button (data-date="YYYY-MM-DD", [data-selected], [aria-current=date], [aria-disabled], [data-outside], and with dayState data-state plus the part day-<state>). ::part() takes no attribute selector, so what the day is comes as part tokens too: day-selected, day-today, day-outside, day-disabled, combinable with day-<state> (::part(day-taken day-selected)).
day-selectedThe selected day (also part day).
day-todayToday (also part day).
day-outsideA day of the month before or after (also part day).
day-disabledA day out of min/max (also part day).

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
date-picker.placeholderPick a date
date-picker.clearClear date
date-picker.dropdownChoose a date
date-picker.previous-monthPrevious month, {month}
date-picker.next-monthNext month, {month}