Calendar
A month grid for picking a date or a range.
Example
<focsd-calendar value="2026-03-14" min="2026-03-05" max="2026-04-20" locale="en-GB"></focsd-calendar>Events and a legend
events marks days with dots: { date, label, kind?, color?, tone? }, as JSON in the attribute or an array in JS. tone (positive, caution, critical, info) shows in every preset; color is a category hue the colorful Prismatic preset shows. legend lists each kind once.
<div data-focsd-brand="prismatic"> <focsd-calendar value="2026-11-26" locale="en-US" legend events='[{"date":"2026-11-03","label":"Team sync","kind":"Meeting","color":"blue"},{"date":"2026-11-10","label":"Team sync","kind":"Meeting","color":"blue"},{"date":"2026-11-07","label":"Launch review","kind":"Deadline","tone":"critical"},{"date":"2026-11-14","label":"Founders day","kind":"Holiday","color":"amber"},{"date":"2026-11-17","label":"Team sync","kind":"Meeting","color":"blue"},{"date":"2026-11-17","label":"Design critique","kind":"Review","color":"violet"},{"date":"2026-11-21","label":"Q4 plan due","kind":"Deadline","tone":"critical"}]'></focsd-calendar></div>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-calendar.js';</script>
<focsd-calendar value="2026-03-14" min="2026-03-05" max="2026-04-20" locale="en-GB"></focsd-calendar>import { Calendar } from '@focsd-dev/react';
export function Example() { return <Calendar onChange={(e) => console.log(e.target)} value="2026-03-14" min="2026-03-05" max="2026-04-20" locale="en-GB"></Calendar>;}<script setup>import '@focsd-dev/components/focsd-calendar.js';</script>
<template> <focsd-calendar @change="onChange" value="2026-03-14" min="2026-03-05" max="2026-04-20" locale="en-GB"></focsd-calendar></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-calendar.js';
// template<focsd-calendar (change)="onChange($event)" value="2026-03-14" min="2026-03-05" max="2026-04-20" locale="en-GB"></focsd-calendar><script> import '@focsd-dev/components/focsd-calendar.js';</script>
<focsd-calendar onchange={(e) => console.log(e.target)} value="2026-03-14" min="2026-03-05" max="2026-04-20" locale="en-GB"></focsd-calendar>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
value | value | string | — |
min | min | string | — |
max | max | string | — |
range | range | boolean | false |
value-start | valueStart | string | — |
value-end | valueEnd | string | — |
locale | locale | string | — |
events | events | CalendarEvent[] | [] |
legend | legend | boolean | false |
Methods
| Method | Description |
|---|---|
focusDay() | Move keyboard focus to the active day (used by date pickers when their dialog opens). |
select(iso) | Choose a date; in range mode the first pick sets the start, the second the end. |
Events
| Event | Description |
|---|---|
change | Fired when the user commits a change to the value or state. |
CSS parts
Style the inside of the component with ::part(), for example focsd-calendar::part(day).
| Part | Description |
|---|---|
day | Each day cell. |
grid | The grid element. |
header | The header element. |
heading | The heading element. |
nav | Both month buttons. |
next | The next month button. |
pad | An empty cell before the first or after the last day of the month. |
previous | The previous month button. |
range-edge | Added to the first and last day of a selected range. |
selected | Added to selected days. |
today | Added to today's date. |
weekday | A weekday column header. |
events | The markers under a day with events. |
event | One event marker (in a day or the legend). |
legend | The list of event kinds, with `legend`. |
legend-item | One event kind in the legend. |
Accessibility
- APG date grid:
role="grid"labeled by the month heading, which is a polite live region. - Each day has a full accessible name ("Saturday, 14 March 2026"),
aria-selected,aria-current="date"for today, andaria-disabledoutsidemin/max. - One tab stop (roving tabindex); arrows are mirrored in right-to-left pages. The first day of the week comes from the locale.
Keyboard
| Key | Action |
|---|---|
| Arrow keys | Previous / next day or week |
| Page Up / Down | Previous / next month |
| Shift + Page Up / Down | Previous / next year |
| Home / End | Start / end of the week |
| Enter / Space | Select the day |
Events and a legend
- The dots are decorative: each day's accessible name includes its events and their kinds ("Tuesday, November 17, 2026, Team sync (Meeting), Design critique (Review)"), and a tooltip shows them on hover, so nothing depends on color.
- The legend is a list labeled "Event types" (localizable as
calendarLegend). - Up to three dots show per day; every event is still named in the label.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.