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

SunMonTueWedThuFriSat
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

SunMonTueWedThuFriSat
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

LMXJVSD
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.Root as the stateful container; selectionMode supports 'single' (default) and 'range'.
  • In controlled mode use value with onChange; in uncontrolled mode use defaultValue. Single mode uses YYYY-MM-DD, range mode uses { start?, end? }.
  • visibleMonths controls how many months are rendered and how paging behaves.
  • showOutsideDays controls whether days outside the current month are shown (default false).
  • isDateUnavailable marks specific days as non-focusable and non-selectable.
  • Use monthHeadingStyle="month-year" on Calendar.Root to 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/ArrowLeft move focus by one day; ArrowDown/ArrowUp move by one week.
  • Home/End jump to the first/last day of the month; PageUp/PageDown move to the previous/next month while preserving the day number.
  • Enter or Space selects 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.

Prop Type Default

* required. Native HTML attributes of the underlying element are also accepted.

Data attribute Description
data-disabled Present when the calendar is disabled.
data-readonly Present when the calendar is readonly.

TriggerPrevious

Button that pages the calendar to the previous month (or set of visible months).

Prop Type Default

* 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).

Prop Type Default

* 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.

Prop Type Default

* required. Native HTML attributes of the underlying element are also accepted.

Data attribute Description
data-calendar-grid Identifies the grid element.
data-calendar-month The ISO month (YYYY-MM) rendered by this grid.

GridHeader

The weekday header row. Iterates the localized weekday labels and passes each to the children snippet.

Prop Type Default

* required. Native HTML attributes of the underlying element are also accepted.

HeaderCell

One weekday label cell inside the grid header row.

Prop Type Default

* 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.

Prop Type Default

* required. Native HTML attributes of the underlying element are also accepted.

Data attribute Description
data-week Identifies a week row inside the grid body.

BodyCell

One focusable day cell. Handles selection, keyboard navigation, and exposes its full state through data attributes.

Prop Type Default

* required. Native HTML attributes of the underlying element are also accepted.

Data attribute Description
data-date The ISO YYYY-MM-DD date of the cell.
data-disabled Present when the day cannot be selected (calendar disabled or date unavailable).
data-focus-visible Present while focus should be visibly indicated (keyboard modality).
data-focused Present while the cell has focus.
data-hovered Present while the pointer is over the cell.
data-in-range Present when the day falls inside the selected or previewed range.
data-outside-month Present when the day belongs to an adjacent month.
data-pressed Present while the cell is actively pressed.
data-range-end Present on the last day of the selected or previewed range.
data-range-start Present on the first day of the selected or previewed range.
data-selected Present when the day is selected.
data-today Present on today's date.
data-unavailable Present when isDateUnavailable marks the day as unavailable.