Calendar
A composable calendar providing single-date and range selection (ISO YYYY-MM-DD) with keyboard navigation, controlled/uncontrolled state, and part-based composition.
August 2026
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Anatomy
Calendar.Root is the stateful container. The triggers and heading page through months, while Calendar.Grid renders one month as an accessible grid built from header and body cells.
<script>
import { Calendar, LocaleProvider } from '@human-kit/ui';
</script>
<LocaleProvider locale="es-ES">
<Calendar.Root>
<Calendar.TriggerPrevious />
<Calendar.Heading />
<Calendar.TriggerNext />
<Calendar.Grid weekdayStyle="narrow">
<Calendar.GridHeader />
<Calendar.GridBody />
</Calendar.Grid>
</Calendar.Root>
</LocaleProvider>Range selection
Set selectionMode="range" to select a { start, end } pair: the first click starts the range, hover previews it, and the second click confirms it (reversed order is normalized automatically). isDateUnavailable marks specific days — weekends here — as non-selectable.
August 2026
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Locale
Wrap the calendar in a LocaleProvider to localize the month heading, weekday labels, and first day of the week. Use firstDayOfWeek on Calendar.Root to override the locale default, and weekdayStyle on Calendar.Grid to switch between narrow, short, and long weekday labels.
agosto de 2026
| L | M | X | J | V | S | D |
|---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Usage guidelines
- Use
Calendar.Rootas the stateful container;selectionModesupports'single'(default) and'range'. - In controlled mode use
valuewithonChange; in uncontrolled mode usedefaultValue. Single mode usesYYYY-MM-DD, range mode uses{ start?, end? }. visibleMonthscontrols how many months are rendered and how paging behaves.showOutsideDayscontrols whether days outside the current month are shown (defaultfalse).isDateUnavailablemarks specific days as non-focusable and non-selectable.- Use
monthHeadingStyle="month-year"onCalendar.Rootto render headings as separate month and year parts.
Accessibility
- Each grid exposes an accessible name using the visible month heading, and today exposes
aria-current="date". - Unavailable cells expose
aria-disabled="true"but remain focusable, so screen reader users can spatially navigate and discover them. ArrowRight/ArrowLeftmove focus by one day;ArrowDown/ArrowUpmove by one week.Home/Endjump to the first/last day of the month;PageUp/PageDownmove to the previous/next month while preserving the day number.EnterorSpaceselects the focused date; in range mode they confirm the pending preview range.
API reference
Root
The stateful container. Holds the selection state, visible months, and paging logic shared by all calendar parts.
* required. Native HTML attributes of the underlying element are also accepted.
TriggerPrevious
Button that pages the calendar to the previous month (or set of visible months).
* required. Native HTML attributes of the underlying element are also accepted.
Heading
Displays the visible month heading, localized through the active locale and formatted per monthHeadingStyle.
TriggerNext
Button that pages the calendar to the next month (or set of visible months).
* required. Native HTML attributes of the underlying element are also accepted.
Grid
Renders the visible month(s) as accessible grids named after the month heading.
* required. Native HTML attributes of the underlying element are also accepted.
GridHeader
The weekday header row. Iterates the localized weekday labels and passes each to the children snippet.
* required. Native HTML attributes of the underlying element are also accepted.
HeaderCell
One weekday label cell inside the grid header row.
* required. Native HTML attributes of the underlying element are also accepted.
GridBody
The day cells area. Iterates the visible days and passes each ISO date to the children snippet.
* required. Native HTML attributes of the underlying element are also accepted.
BodyCell
One focusable day cell. Handles selection, keyboard navigation, and exposes its full state through data attributes.
* required. Native HTML attributes of the underlying element are also accepted.