Skip to content

Date Picker

A date field that opens a Calendar in a popover. The readonly combobox field is the trigger; picking a day fills the field and closes the popover.

<script>
import DatePicker from "@invisible-ui/svelte/DatePicker.svelte";
</script>

In Elements, name submits the ISO date with the form:

<form>
<ds-date-picker label="Due date" name="due" value="2026-06-15" clearable></ds-date-picker>
</form>
PropTypeDefaultDescription
valuestring | nullnull
minstring | undefinedundefined
maxstring | undefinedundefined
weekStartsOnWeekStart | undefinedundefinedFirst day of the week, 0 = Sunday … 6 = Saturday. Defaults to the locale's first day of the week (from locale, else the provider's).
localestring | undefinedundefined
dateStyle"full" | "long" | "medium" | "short""medium"Intl style for the field display.
labelstring | undefinedundefinedAccessible label for the field.
placeholderstring | undefinedundefinedShown when empty.
disabledbooleanfalseDisable the field.
clearablebooleanfalseShow a clear button when a date is set.
eventsCalendarEvent[][]Appointment dots, forwarded to the calendar.
pricesRecord<string, string>{}Per-day prices, forwarded to the calendar.
namestring | undefinedundefinedForm field name — the selected ISO date is submitted under it (via a hidden input).
onValueChange((value: string | null) => void) | undefinedundefinedCalled when the date changes (or is cleared).
  • The field is a readonly role="combobox" (aria-haspopup, aria-expanded): a click, Enter, Space or ArrowDown opens it. Focus moves to the selected day, or to the day the calendar would focus when none is selected, not to the Today button.
  • Picking a day, or pressing Escape, closes the calendar and returns focus to the field. The clear button keeps focus on the field when it removes itself.
  • See the Calendar for the grid’s keyboard model.
<DatePicker value="2026-06-15" label="Event date" clearable />

In React, onValueChange reports the picked date, or null when cleared:

<DatePicker label="Event date" value={date} name="date" clearable onValueChange={setDate} />

Themeable via --ds-date-picker-* and the calendar’s --ds-calendar-*.