Skip to content

Calendar

June 2026

Calendar view
SunMonTueWedThuFriSat

A WAI-ARIA date grid with keyboard navigation, selection, appointment dots and per-day prices. Switch between month, two-month, week, three-day, day and year views.

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

In Elements, names come from Intl. Events and prices are properties:

<ds-calendar value="2026-06-15" views="month week day"></ds-calendar>
<script type="module">
const calendar = document.querySelector("ds-calendar");
calendar.events = [{ date: "2026-06-18", label: "Review", tone: "warning" }];
calendar.addEventListener("change", (event) => console.log(event.detail.value));
</script>
PropTypeDefaultDescription
valuestring | nullnull
focusedDatestring | undefinedundefined
viewCalendarView"month"
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).
minstring | undefinedundefined
maxstring | undefinedundefined
localestring | undefinedundefinedBCP-47 locale for month/weekday names.
eventsCalendarEvent[][]Appointment dots ({ date, label?, tone? }), keyed by date.
pricesRecord<string, string>{}Per-day price label, keyed by ISO date.
maxDotsnumber3Max appointment dots before a "+N" overflow marker.
yearColumnsnumber1Mini-months per row in the year view.
viewsCalendarView[]["month"]Views offered in the built-in switcher (one entry = no switcher).
viewLabelsPartial<Record<CalendarView, string>>{}Override the switcher labels per view.
showTodaybooleantrueShow the "today" shortcut in the header.
prevLabelstring | undefinedundefinedHeader control labels (fall back to the i18n catalog).
nextLabelstring | undefinedundefinedHeader control labels (fall back to the i18n catalog).
todayLabelstring | undefinedundefinedHeader control labels (fall back to the i18n catalog).
viewsLabelstring | undefinedundefinedAccessible name for the view switcher.
labelstring | undefinedundefinedAccessible name for the grid (falls back to the i18n catalog).
mode"single" | "range""single"Single date, or a start–end range.
rangeStartstring | nullnullRange endpoints (when mode="range").
rangeEndstring | nullnullRange endpoints (when mode="range").
onValueChange((iso: string) => void) | undefinedundefinedCalled when the selected date changes.
onFocusChange((iso: string) => void) | undefinedundefinedCalled when the focused date changes.
onViewChange((view: CalendarView) => void) | undefinedundefinedCalled when the active view changes.
onRangeChange((start: string | null, end: string | null) => void) | undefinedundefinedCalled when the range changes.
daySnippet<[CalendarDayContext]> | undefinedundefinedCustom content of a day in the grid views, replacing the number, dots and price.
  • role="grid" of day buttons with roving tabindex; arrows move by day/week, Home/End to the week edges, PageUp/PageDown by month (Shift = year), Enter/Space selects.
  • In right-to-left text ArrowLeft moves to the next day and ArrowRight to the previous one, and the previous and next arrows are mirrored.
  • The period title is announced (aria-live); out-of-range days are aria-disabled; today is aria-current="date".
  • In mode="range" every day of the range, the two ends and the days between, is a selected cell (aria-selected). The ends add “range start” and “range end” to the day’s name, and a day with events adds the event count. These texts come from the message catalog, so a Locale Provider can translate them.

Without weekStartsOn, every adapter starts the week on the locale’s first day from CLDR week data, read from the language and the region: Sunday for en-US, Monday for it-IT and en-GB, Saturday for ar-EG. The locale is the calendar’s locale, else the Locale Provider’s, else the page’s lang, else the international default, which starts on Monday (see Default locale). The browser’s own language never decides. Set weekStartsOn (0 = Sunday … 6 = Saturday) to choose the day yourself.

<Calendar
value="2026-06-15"
views={["month", "week", "day"]}
events={[{ date: "2026-06-18", label: "Review", tone: "warning" }]}
prices={{ "2026-06-12": "€120" }}
/>

In React, onValueChange reports a pick, mode="range" reports both ends through onRangeChange, and renderDay replaces a day’s content:

<Calendar value={day} views={["month", "week"]} events={events} onValueChange={setDay} />

Themeable via --ds-calendar-*.