Calendar
This is a calendar that you assemble from parts. The user can select one date or a range of dates, in the ISO format YYYY-MM-DD. The keyboard operates the grid. You can control the state, or you can let the component control it.
September 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 |
Anatomy
Calendar.Root is the container with the state. The triggers and the heading move the calendar from one month to the next month. Calendar.Grid makes one month as an accessible grid of header cells 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. While the pointer moves, the calendar shows the range. The second click completes the range. If the user selects the two dates in the opposite sequence, the component corrects them. The isDateUnavailable prop makes specified days unavailable — in this example, the weekend days.
September 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 |
Locale
Put the calendar in a LocaleProvider to localize the month heading, the weekday names, and the first day of the week. Use firstDayOfWeek on Calendar.Root to replace the default of the locale. Use weekdayStyle on Calendar.Grid to select narrow, short, or long weekday names.
septiembre 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 |
Usage guidelines
- Use
Calendar.Rootas the container with the state. TheselectionModeprop accepts'single'(the default) and'range'. - When your own code controls the state, use
valuewithonChange. When the component controls the state, usedefaultValue. The single mode usesYYYY-MM-DD. The range mode uses{ start?, end? }. - The
visibleMonthsprop sets the number of the months in the calendar, and it changes how the triggers move between the months. - The
showOutsideDaysprop controls the days that are not in the current month. The default isfalse, and the calendar does not show them. - The
isDateUnavailableprop makes specified days unavailable. The user cannot select them and the focus does not go to them. - Use
monthHeadingStyle="month-year"onCalendar.Rootto make the heading in two parts: the month and the year.
Accessibility
- Each grid has an accessible name. The name comes from the month heading that the user sees. The day of today has
aria-current="date". - An unavailable cell has
aria-disabled="true", but it keeps the focus. Thus a screen reader user can move to it and read it. - The
ArrowRightkey and theArrowLeftkey move the focus by one day. TheArrowDownkey and theArrowUpkey move the focus by one week. - The
Homekey and theEndkey move the focus to the first day and to the last day of the month. ThePageUpkey and thePageDownkey move the focus to the previous month and to the next month. The day number stays the same. - The
Enterkey and theSpacekey select the date with the focus. In the range mode, they complete the range.
API reference
Root
The container with the state. It holds the selection state, the months that the user sees, and the code that moves between the months. All of the calendar parts share it.
* required. Native HTML attributes of the underlying element are also accepted.
TriggerPrevious
The button that moves the calendar to the previous month, or to the previous set of months.
* required. Native HTML attributes of the underlying element are also accepted.
Heading
Shows the heading of the month. The active locale gives its language, and monthHeadingStyle gives its format.
TriggerNext
The button that moves the calendar to the next month, or to the next set of months.
* required. Native HTML attributes of the underlying element are also accepted.
Grid
Makes each month that the user sees into an accessible grid. The month heading gives the grid its name.
* required. Native HTML attributes of the underlying element are also accepted.
GridHeader
The header row of the weekdays. It goes through the localized weekday names and gives each one to the children snippet.
* required. Native HTML attributes of the underlying element are also accepted.
HeaderCell
One cell with a weekday name, in the header row of the grid.
* required. Native HTML attributes of the underlying element are also accepted.
GridBody
The area of the day cells. It goes through the days that the user sees and gives each ISO date to the children snippet.
* required. Native HTML attributes of the underlying element are also accepted.
BodyCell
One day cell that can take the focus. It controls the selection and the keyboard operation, and it shows its full state in data attributes.
* required. Native HTML attributes of the underlying element are also accepted.