Skip to
Keyboard shortcuts

Use the up and down arrow keys to move between items. Press Alt+Shift+K to open this list again.

Alpha version out now. The API may still change.

Calendar

A month as a grid of days, for choosing one date near today or, in range mode, a start and an end. Someone using only a keyboard reaches the whole month with one Tab stop and the date keys. Every day has a full name that a screen reader (software that reads the screen aloud) speaks. It sits beside a typed field and never replaces it.

Package
@kvirn-ui/react
Pattern
APG Date Picker Dialog (the calendar grid)
Testing
Not yet verified. Automated 3 of 5, Core 0 of 2, Release 0 of 3

When to use it#

  • Use it to choose a date near today, such as a booking or a start date. Put it beside a field where the same date can be typed. Typing must always work, because the calendar is the slower way for people who use a keyboard or a screen reader.
  • Use it in forms for residents and for staff, and as a section of a page. To open it from a button, use DatePicker, or DateRangePicker for a start and an end in two fields.
  • Not for a date the user knows by heart, such as a date of birth: use DateInput.
  • Not when most days are unavailable: offer the few open days as radio buttons.

Example#

November 2026

MondayTuesdayWednesdayThursdayFridaySaturdaySunday
1
2345678
9101112131415
16171819202122
23242526272829
30

Use cases#

Beside a typed field

Keep the date in your form state as the text of the field, and give the Calendar the same date as YYYY-MM-DD. Choosing a day writes it into the field, and typing a real date selects it in the Calendar. The Calendar is a companion to typing, never the only way.

For example 27/10/2026

November 2026

MondayTuesdayWednesdayThursdayFridaySaturdaySunday
1
2345678
9101112131415
16171819202122
23242526272829
30

Props in this example:

Only some dates can be chosen

Set minimum and maximum, such as the days a service takes bookings. The keys and the month buttons stop there, and days outside are struck through. today is fixed in this example so the dates are the same on any day.

October 2026

Dates from October 14, 2026 to December 31, 2026

MondayTuesdayWednesdayThursdayFridaySaturdaySunday
1234
567891011
12131415161718
19202122232425
262728293031

Chosen: no day yet

Props in this example:

Warning: Don't forget

Render Calendar.RangeHint whenever there is a limit, so the dates that can be chosen are written in words. See What you need to do.

Days that are closed, with the reason

A day that can’t be chosen, such as a closed recycling centre, stays focusable and is drawn struck through. A screen reader says the reason as part of the day’s name. Say in words above the calendar that closed days are struck through and can’t be chosen, so the meaning is never carried by the shape alone (1.3.3 Sensory Characteristics).

Closed days are struck through and can’t be chosen.

October 2026

MondayTuesdayWednesdayThursdayFridaySaturdaySunday
1234
567891011
12131415161718
19202122232425
262728293031

Props in this example:

Week numbers for planners

People who plan by week, such as staff on a rota, name a week by its number. The ISO number only fits a week that starts on Monday, so the Calendar hides the column and warns in development with any other start.

October 2026

WeekMondayTuesdayWednesdayThursdayFridaySaturdaySunday
401234
41567891011
4212131415161718
4319202122232425
44262728293031

Props in this example:

A date years away

Add Calendar.PreviousYear and Calendar.NextYear when the date can be years from today, such as the date on an archived document, and open on a day near it with defaultFocusedDate. For a date of birth, typing in DateInput is faster than any calendar.

June 1990

MondayTuesdayWednesdayThursdayFridaySaturdaySunday
123
45678910
11121314151617
18192021222324
252627282930

Props in this example:

A start and an end

For a stay or a leave, set mode="range". The value is { start, end } and the user presses the start, then the end: no extra key. A start alone is reported at once. Two months show side by side from 64rem wide, one below it.

October 2026

Dates from October 14, 2026 2 to 15 days Choose the start date.

MondayTuesdayWednesdayThursdayFridaySaturdaySunday
1234
567891011
12131415161718
19202122232425
262728293031

Chosen stay: no day yet

Props in this example:

Information: Did you know?

Count the days with both ends: a booking of 14 nights is maximumDays 15. To reach a range with a pair of fields, see DateRangePicker.

Accessibility#

What it does for you#

  • APG pattern: Date Picker Dialog, its grid and keys. A standalone Calendar is the grid with its month buttons; the modal dialog belongs to DatePicker.
  • Deviations: none from the APG keys. Range mode (approved by the maintainer 2026-10-06) has no APG pattern and adds no key: a range is two ordinary selections. Decisions, also approved on 2026-10-06: the month is announced through the Announcer on a button press only, not by a live heading; days of other months are empty cells; the year buttons are optional parts; below 40rem wide the day cells are smaller than the comfortable 44 pixels so that seven columns fit a 320 pixel screen (2.5.8 Target Size (Minimum) (AA) is met there; 2.5.5 Target Size (Enhanced) (AAA) is not).
  • Native elements used: <table role="grid"> with <th scope> headers, <td role="gridcell"> days, <button> month and year buttons, <h3>, <p>.

A month as a grid of days for choosing one date near today (a booking, a start date), or with mode="range" a start and an end, one or two months side by side. It is a companion to typed entry (DateInput), never the only way to give a date. Calendar holds the visible month, the focused day and the chosen day in a core store; the consumer owns the chosen value (value and onValueChange, or defaultValue). In range mode the value is { start, end } ('' for none; a start alone is valid) and onValueChange(range, change) runs after every press that changed it.

PartElement / roleARIA / stateNotes
Calendar.Root<div class="kv-calendar">noneHolds the state. No role: the grid is the widget
Calendar.Heading<h3 class="kv-calendar-heading">id, which names the grid. lang when the browser writes the month in another languageNot live. offset={1} is the second month (two months only; else nothing)
Month and year buttons<button type="button">Name from calendar.previousMonth, nextMonth, previousYear, nextYear; aria-disabled="true" and data-disabled at the edge of the range (stays focusable, activation blocked: native disabled would drop focus to body). A Tooltip shows the name on hover and focus (never the only name)Classes kv-calendar-previous-month, -next-month, -previous-year, -next-year. Year buttons are optional parts
Calendar.RangeHint<p class="kv-calendar-range">id, which describes the gridRenders only with a line to say: the minimum and maximum, and in range mode the span limits and the next step (3.3.2)
Calendar.Grid<table role="grid">aria-labelledby the Heading, with the aria-labelledby you pass in front (a from/to pair: "End date, October 2026"); aria-describedby the RangeHint when there is a line; range mode: aria-multiselectable="true"Class kv-calendar-grid. offset={1} is the second month's grid, data-offset
Column header<th scope="col">Short weekday aria-hidden, long weekday visually hiddenIn the order of the week start
Week number<th scope="row">, a rowheaderaria-label calendar.weekName (Vecka 42 in Swedish, "Week 42"). Over it a column header Wk (hidden) and Week (read)Only with weekNumbers and a Monday start
Day<td role="gridcell">, tabindex 0/-1aria-label calendar.dayName (onsdag 14 oktober 2026, idag, <description> in Swedish, "Wednesday 14 October 2026, today, <description>"); aria-selected="true" on the chosen day only (range mode: on the start, the end and every day between); aria-current="date" on today; aria-disabled="true" when unavailable or outside the range. data-selected, data-today, data-unavailable, data-outside-range; range: data-range-start, data-range-end, data-in-range, data-preview, data-preview-end (drawn only)Class kv-calendar-day. Focusable even when unavailable, so a user finds out why. Range names add "start date", "end date" or "start and end date" (startdatum, slutdatum, start- och slutdatum in Swedish), then the length of a possible end, or why a day can't be the end
Empty cell<td class="kv-calendar-empty">aria-hidden="true", no tabindex, no nameDays of other months are not shown
useCalendarthe same attributes, for your own markuprootProps, headingProps, previousMonthProps, nextMonthProps, previousYearProps, nextYearProps, rangeHintProps, gridProps, weeks, months, getDayProps(date)Spread getDayProps(date) on each day's <td>

Rules, each proved by an automated test:

  • The grid is named and described. By the Heading, and by the RangeHint when there is a range. A missing Heading or RangeHint warns once (calendar-heading-missing, calendar-range-hint-missing).
  • Status is never colour alone. Selected is a fill, bold text and aria-selected; today is an edge, bold text and the name; unavailable is a strike-through, aria-disabled and the name.
  • Min and max. A key's target is clamped to the range. Days outside it are aria-disabled and are not selectable. A minimum after the maximum throws a RangeError.
  • Range mode. A press is the start, then the end (started, completed); a day that can't be the end (before the start, too short, too long, past an unavailable day) becomes the new start and is announced, so there is never a silent dead end. selects="start" or "end" is one end of a from/to pair sharing one range; an impossible end of selects="end" is aria-disabled and data-unavailable, with its reason in the name. The span is counted in inclusive days (minimumDays, maximumDays); an unavailable day blocks the range unless allowUnavailableInRange. The preview (hover, focus) is drawn only: the length is in each candidate's name, not announced. aria-selected on every day in the range is the maintainer's choice; how screen readers voice it is a question for the manual AT run.
  • Two months show side by side from 64rem (visibleMonths={2} is a maximum, one on the server, then the media query), one Tab stop and one focused day across both grids; one below 64rem so it never breaks 320px or 400% zoom.
  • Limits. minimumDays or maximumDays below 1, or a minimum above the maximum, is ignored with a development warning (calendar-range-days-invalid).
  • Week numbers are ISO 8601 and need a Monday start; another start hides them and warns once (calendar-week-numbers-need-monday).
  • Month and weekday names come from Intl with the Gregorian calendar and Latin digits.

What you need to do#

  • Offer typed entry beside the Calendar (a DateInput): the Calendar is slower for keyboard and screen reader users. Don't use it for a date of birth, and prefer radios when many days are unavailable.
  • Say why a day is unavailable in getDateDescription, and keep the visible range text (RangeHint) when there is a minimum or maximum.
  • Render the Heading; it names the grid.
  • Set weekStart on the KvirnProvider (or the Calendar) explicitly for server rendering: the locale-derived default reads Intl, which can differ between server and browser.
  • Wrap the app in a KvirnProvider: it holds the Announcer.

Warning: Don't forget

Render Calendar.Heading in every Calendar. It names the grid: without it the grid has no name and a screen reader user can’t tell which month it shows (4.1.2 Name, Role, Value). A warning in development tells you.

Visual and modes#

  • Focus indicator: a ring at least 2 pixels thick, with at least 3:1 contrast against its surroundings (2.4.13 Focus Appearance, AAA), drawn in the gap between cells. If you restyle the Calendar, keep the ring visible and keep the gap, so it never covers a neighbouring day.
  • Target size: day cells are the size of other controls on wide screens, smaller in the compact density, and smaller again below 40rem wide so that seven columns fit a 320 pixel screen (a recorded exception to the comfortable 44 pixels). Every size is above the 24 by 24 pixel minimum of 2.5.8 Target Size (Minimum) (AA). Month buttons are the size of other controls.
  • Forced colours (a user's high-contrast mode) uses the system's text and highlight colours: today has a text-coloured edge, the chosen day is filled with the highlight colour, an unavailable day is greyed out with a strike-through, and hover is a highlight-coloured edge. The edges are borders, because forced colours drops a shadow.
  • Range, forced colours: the start and end look like a chosen day. The days between have highlight-coloured edges and no fill, and the preview is dashed. Hover inside the band adds a highlight-coloured border, and an unavailable day in an allowed range is greyed out with a strike-through. Never colour alone: the start and end have a fill, bold text, a shape and a name, and the band has edges and aria-selected.
  • Reduced motion: no motion.
  • Right to left: the columns and the chevrons mirror, and the arrow keys follow the reading direction.

Focus management#

  • Initial focus: not moved. The Tab stop is the chosen day, else defaultFocusedDate, else today, clamped to the range.
  • After a key move: focus follows to the new day's cell, in the new month when it crosses. After a month or year button: focus stays on the button.
  • Trap: no (a standalone Calendar). DatePicker's modal Dialog traps.
  • Restore to: not applicable. DatePicker returns focus to its trigger.
  • Never obscured by: the focus ring is drawn outside the cell, in the gap between cells, so it never covers a neighbouring day (2.4.11 Focus Not Obscured (Minimum) (AA), 2.4.13 Focus Appearance (AAA)).

WCAG success criteria#

  • 1.3.1 Info and Relationships (A), 4.1.2 Name, Role, Value (A): the grid, headers and gridcells, names and states.
  • 1.4.1 Use of Color (A), 1.4.11 Non-text Contrast (AA): the cues for selected, today and unavailable.
  • 1.4.10 Reflow (AA): a story at 320 pixels wide checks that nothing scrolls sideways, with and without week numbers, and in range mode.
  • 1.4.12 Text Spacing (AA): no automated check.
  • 1.4.13 Content on Hover or Focus (AA): the name of a month or year button also shows as a tooltip, which follows the Tooltip's rules (dismissable, hoverable, persistent).
  • 2.1.1 Keyboard (A), 2.1.4 Character Key Shortcuts (A, there are none), 2.4.3 Focus Order (A), 2.4.7 Focus Visible (AA), 2.4.11 Focus Not Obscured (Minimum) (AA).
  • 2.5.3 Label in Name (A), 2.5.8 Target Size (Minimum) (AA).
  • 3.1.2 Language of Parts (AA): lang on a month written in a fallback language.
  • 3.3.2 Labels or Instructions (A): the range hint, the span limits and the next step.
  • 4.1.3 Status Messages (AA): the month, the chosen day, the start of a range and a finished range.

Keyboard#

Focus
roving tabindex
Selection follows focus
no (Enter or Space selects)
Arrows wrap
no (they cross into the next or previous month)
Shortcuts
none

The month and year buttons are Tab stops; the grid is one Tab stop, on the focused day (the chosen day, else the typed day, else today, kept inside the range). A key with Control, Alt or Meta is never taken.

KeyWhereWhat happens
TabCalendarMonth (and year) buttons, then the grid as one stop on the focused day, then out
Test: calendar.test.tsx › Tab moves from before the calendar through the month buttons to the grid, one stop
Shift+TabgridBack to the month and year buttons, then out
Test: calendar.test.tsx › Shift+Tab moves from the grid back to the month buttons
ArrowRightdayNext day, into the next month at the end of one (flips in RTL)
Test: calendar.test.tsx › ArrowRight moves focus to the next day and the key is not left native
ArrowLeftdayPrevious day, into the previous month at the start of one (flips in RTL)
Test: calendar.test.tsx › ArrowLeft moves focus to the previous day
ArrowRight / ArrowLeftday, RTLPrevious and next day: the arrows follow the reading direction
Test: calendar.test.tsx › ArrowRight and ArrowLeft flip in RTL
ArrowDown / ArrowUpdaySame weekday next and previous week (never flips)
Test: calendar.test.tsx › ArrowDown and ArrowUp move a week and do not flip in RTL
ArrowRightlast dayCrosses into the next month; the heading follows
Test: calendar.test.tsx › an arrow past the last day crosses into the next month and the heading follows
Home / EnddayFirst and last day of the week, by the week start
Test: calendar.test.tsx › Home and End go to the first and last day of the week by the week start
Home / Endday, Sunday startThe same with the week starting on Sunday
Test: calendar.test.tsx › Home and End follow a Sunday week start
PageDown / PageUpdaySame day next and previous month, cut to its length
Test: calendar.test.tsx › PageDown and PageUp move a month
Shift+PageDown / Shift+PageUpdaySame day next and previous year
Test: calendar.test.tsx › Shift+PageDown and Shift+PageUp move a year
(any move)at min or maxThe target is clamped to the range; at the edge focus stays and the key is still taken
Test: calendar.test.tsx › at the edge of the range the key is still taken and focus stays
Control, Alt or Meta + keydayNot taken: the browser's own shortcut (Alt+ArrowLeft is Back)
Test: calendar.test.tsx › a key with Control, Alt or Meta is left native
Enteravailable dayChooses the day and reports it
Test: calendar.test.tsx › Enter selects an available day and reports it
Spaceavailable dayChooses the day; the page does not scroll
Test: calendar.test.tsx › Space selects an available day and does not scroll the page
Enter / Spaceunavailable dayNothing; focus stays
Test: calendar.test.tsx › Enter and Space on an unavailable day select nothing
Entermonth buttonShows that month; focus stays on the button; the focused day moves to the same day, cut
Test: calendar.test.tsx › Enter on a month button shows that month and focus stays on the button
Spaceyear buttonShows the same month a year on or before; focus stays
Test: calendar.test.tsx › Space on a year button shows the same month a year on
Enter / Spacemonth button at the edgeNothing; focus stays
Test: calendar.test.tsx › Enter on a month button at the edge does nothing and focus stays
EscapedayNot handled. In a DatePicker the Dialog closes
Test: calendar.test.tsx › Escape is not handled by a standalone calendar
Tabtwo monthsMonth buttons, then both grids as one stop on the focused day, then out
Test: calendar-range.test.tsx › Tab with two months passes the month buttons, then both grids as one stop
Shift+Tabtwo months, gridBack to the month buttons
Test: calendar-range.test.tsx › Shift+Tab from the grid goes back to the month buttons
ArrowRightlast day of a grid, two monthsCrosses into the other grid; the view moves only when the day leaves both
Test: calendar-range.test.tsx › ArrowRight on the last day of the first grid crosses into the second without moving the view
ArrowLeftfirst day of a grid, two monthsCrosses back into the first grid
Test: calendar-range.test.tsx › ArrowLeft on the first day of the second grid crosses back
ArrowRight / ArrowLefttwo months, RTLFlip, across the two grids too
Test: calendar-range.test.tsx › ArrowRight and ArrowLeft flip in RTL across the two grids
PageDowntwo monthsSame day next month; the view moves only when the day leaves both grids
Test: calendar-range.test.tsx › PageDown with two months keeps the view until the day leaves both grids
PageUptwo monthsSame day previous month, the view kept while the day stays in view
Test: calendar-range.test.tsx › PageUp with two months keeps the view until the day leaves both grids
Enteravailable day, start stepSets the start and announces "choose the end date"
Test: calendar-range.test.tsx › Enter on an available day at the start step sets the start
Spacepossible endSets the end; the finished range is reported and announced
Test: calendar-range.test.tsx › Space on a possible end sets the end and reports the finished range
Enterstart again, end stepA one-day range when minimumDays is 1 or less
Test: calendar-range.test.tsx › Enter on the start again at the end step makes a one-day range
Enterday that can't end itBecomes the new start, announced (too far)
Test: calendar-range.test.tsx › Enter on a day that can not end the range makes it the new start, announced
Enterday before the startBecomes the new start
Test: calendar-range.test.tsx › Enter on a day before the start makes it the new start
Enterimpossible end, selects="end"Nothing; focus stays
Test: calendar-range.test.tsx › Enter on an impossible end with selects="end" does nothing and focus stays
Enterunavailable day, rangeNothing; focus stays
Test: calendar-range.test.tsx › Enter on an unavailable day does nothing and focus stays
Enterselects="start", start after the end or too farSets the start, clears the end, announces both
Test: calendar-range.test.tsx › Enter with selects="start" after the end clears the end and announces both
Control, Alt or Meta + keyday, rangeNot taken
Test: calendar-range.test.tsx › a key with Control, Alt or Meta is left native in range mode
Escapeday, rangeNot handled. A DateRangePicker closes and drops the draft
Test: calendar-range.test.tsx › Escape is not handled by a standalone range calendar

A click on an available day chooses it (a click selects a day, and a click on one outside the range does not; in range mode a click on an available day reports at once and each press carries its reason in calendar-range.test.tsx).

Announcements#

Calendar tells screen reader users about these changes without moving focus. Each message waits until the screen reader is quiet (polite) or interrupts it (assertive).

WhenWhat it saysMessage keyPoliteness
A month or year buttonPolite
A day is chosenWednesday 14 October 2026 selectedcalendar.selectedPolite
Month button, two monthsNovember 2026 and December 2026calendar.visibleMonthsPolite
Range: the start pressed, or a restartStart date 14 October 2026. Choose the end date.calendar.rangeChooseEndPolite
Range: the end pressed (completed)14 October 2026 to 20 October 2026 selected, 7 dayscalendar.rangeSelectedPolite
selects="end": the end setcalendar.rangeEndSelectedPolite
selects="start": the start setcalendar.selected calendar.rangeEndClearedPolite

The text in all five languages

Change the text#

For your whole app, pass messages to KvirnProvider. For one Calendar, pass its messages prop.

<KvirnProvider messages={{ calendar: { selected: 'Wednesday 14 October 2026 selected' } }}>

Warning: Don't forget

Announcements need a KvirnProvider around your app, outside any <form>, or an Announcer of your own. Without one nothing is announced, and a development warning says so.

What a screen reader reads#

State or actionRead aloudPolitenessTest
Today (aria-current="date")grid, oktober 2026, gridcell, onsdag 14 oktober 2026, idag, current date (October 2026; Wednesday 14 October 2026, today)nonecalendar.test.tsx › today reads as a gridcell with its full date, idag and the current date
The chosen daygridcell, fredag 16 oktober 2026, selected (Friday 16 October 2026)nonecalendar.test.tsx › the chosen day reads as selected
An unavailable daygridcell, fredag 16 oktober 2026, Recycling centre closed, disabled (Friday 16 October 2026)nonecalendar.test.tsx › an unavailable day reads its reason and as disabled
A month button at the edgebutton, Föregående månad, disabled (Previous month)nonecalendar.test.tsx › a month button at the edge reads as a disabled button
The rangegrid, oktober 2026, Datum från 1 oktober 2026 (October 2026, Dates from 1 October 2026)nonecalendar.test.tsx › a range is the grid description
A range gridgrid, oktober 2026, …, multi-selectable (October 2026)nonecalendar-range.test.tsx › a range grid reads as multi-selectable
The startgridcell, fredag 16 oktober 2026, startdatum, selected (Friday 16 October 2026, start date)nonecalendar-range.test.tsx › the start reads its date, start date and selected
A day betweengridcell, lördag 17 oktober 2026, selected (Saturday 17 October 2026)nonecalendar-range.test.tsx › a day between reads as selected
The endgridcell, fredag 23 oktober 2026, slutdatum, selected (Friday 23 October 2026, end date)nonecalendar-range.test.tsx › the end reads its date, end date and selected
A possible endgridcell, torsdag 22 oktober 2026, 7 dagar (Thursday 22 October 2026, 7 days)nonecalendar-range.test.tsx › a possible end reads its length
A day too fargridcell, fredag 6 november 2026, fler än 14 dagar (Friday 6 November 2026, more than 14 days)nonecalendar-range.test.tsx › a day too far reads why it can not end the range
An impossible endgridcell, torsdag 15 oktober 2026, före startdatumet, disabled (Thursday 15 October 2026, before the start date)nonecalendar-range.test.tsx › an impossible end reads its reason and as disabled
The start pressedpolite: Startdatum fredag 16 oktober 2026. Välj slutdatum. (Start date Friday 16 October 2026. Choose the end date.)politecalendar-range.test.tsx › the first press announces the start and the next step, politely
The end pressedpolite: fredag 16 oktober 2026 till fredag 23 oktober 2026 valda, 8 dagar (Friday 16 October 2026 to Friday 23 October 2026 selected, 8 days)politecalendar-range.test.tsx › completing the range announces both dates and the length, politely
A restartpolite: Startdatum fredag 6 november 2026. Välj slutdatum. (Start date Friday 6 November 2026. Choose the end date.)politecalendar-range.test.tsx › a restart announces the new start
selects="end": the end setpolite: Slutdatum fredag 23 oktober 2026 valt. (End date Friday 23 October 2026 selected.)politecalendar-range.test.tsx › selects="end" announces the end that was set
selects="start", end clearedpolite: onsdag 14 oktober 2026 vald Slutdatum rensat. (Wednesday 14 October 2026 selected. End date cleared.)politecalendar-range.test.tsx › selects="start" after the end announces the start and that the end was cleared, politely
Month button, two monthspolite: november 2026 och december 2026 (November 2026 and December 2026)politecalendar-range.test.tsx › a month button with two months announces both months, politely
Hover, an arrow, the previewnothingnonecalendar-range.test.tsx › hover and an arrow key announce nothing
A week numberrowheader, Vecka 42 (Week 42)nonecalendar.test.tsx › a week number reads as a row header named Vecka 42
Next month pressedpolite: november 2026 (November 2026)politecalendar.test.tsx › Next month announces the new month, politely
A day chosenpolite: fredag 16 oktober 2026 vald (Friday 16 October 2026 selected)politecalendar.test.tsx › choosing a day announces it, politely

API reference#

import { Calendar, useCalendar } from '@kvirn-ui/react'

Calendar.Root

Renders <div> with no role. It takes every attribute of a <div> and passes ref to it. It renders nothing for you: write the parts you need inside it. The default theme is described on Theming.

PropTypeDefaultDescription
defaultFocusedDateIsoDateTodayThe day the grid opens on when none is chosen, such as a date the user typed. Read once, when the Calendar mounts.
minimumIsoDate–The first day that can be chosen, as YYYY-MM-DD. The keys and the month buttons stop here. A minimum after the maximum throws a RangeError.
maximumIsoDate–The last day that can be chosen, as YYYY-MM-DD.
isDateUnavailable(date: IsoDate) => boolean–A day inside the range that can’t be chosen. It stays focusable, drawn struck through, with aria-disabled. Say why in getDateDescription.
getDateDescription(date: IsoDate) => string | undefined–Extra words for a day’s name, such as why it is unavailable: "Recycling centre closed".
weekStartWeekStartThe provider’sThe first day of the week, 1 (Monday) to 7 (Sunday). Else the provider’s, else the locale’s when it names a region, else Monday.
weekNumbersbooleanfalseShows the ISO 8601 week number before each week. Only with a Monday start: another start hides them and warns in development.
todayIsoDateThe clockToday as YYYY-MM-DD. Else read from the clock in the provider’s time zone, once, on mount.
announcebooleantrueAnnounces the new month after a month or year button, and what a press did after a day is chosen, through the Announcer. Set false when your own markup says it.
visibleMonths1 | 21The most months side by side. Two show only from 64rem wide, one below it and on the server.
messagesPartial<KvirnMessages['calendar']>–Replaces the Calendar’s strings for this instance.
mode'single' | 'range''single'Single chooses one day. Range chooses a start and an end with two ordinary presses and adds no key. It decides the shape of value, defaultValue and onValueChange.
valueIsoDate | DateRange–Controlled. Single: the chosen day as YYYY-MM-DD, or "" for none. Range: { start, end }, "" for a day not chosen. Pair it with onValueChange.
defaultValueIsoDate | DateRange–Uncontrolled: the day or range chosen at first.
onValueChange(date: IsoDate) => void | (range: DateRange, change: CalendarRangeChange) => void–Single: called with the day when an available day is chosen. Range: called after every press that changed the range, so a start alone is reported at once; change.step is "complete" when the range is finished.
selects'both' | 'start' | 'end''both'Range only. Which end a press sets: both (start, then end), or one end of a from/to pair of Calendars that share one range.
minimumDaysnumber–Range only. The fewest days, counting both ends (a one-day range is 1).
maximumDaysnumber–Range only. The most days, counting both ends. A booking of 14 nights is 15.
announceChoicebooleantrueAnnounce the press that completes a choice: the day, or the finished range. Set false when something else says it, as a picker does. The month is still announced.
allowUnavailableInRangebooleanfalseRange only. Lets a range pass over an unavailable day, such as a leave across a holiday. By default it blocks.
Class or attributeValuesMeaning
kv-calendaralwaysThe part class. The default theme styles it.

Calendar.Heading

Renders An <h3> with the month and year. It names the grid. It takes every attribute of an <h3> and passes ref to it.

PropTypeDefaultDescription
offset0 | 101 for the second month when visibleMonths is 2. Renders nothing while one month shows.
Class or attributeValuesMeaning
kv-calendar-headingalwaysThe part class. The id is what names the grid.
langa language code or absentSet when the browser had to write the month name in another language (3.1.2).

Calendar.PreviousMonth

Renders A <button type="button"> with an icon and the name calendar.previousMonth, shown as a tooltip too. It takes every attribute of a <button> and passes ref to it. At the edge of the range it stays focusable and sets aria-disabled. Pass children to replace the icon, and keep any visible text the same as the name (2.5.3 Label in Name).

Class or attributeValuesMeaning
kv-calendar-previous-monthalwaysThe part class. The default theme styles it.
aria-disabled"true" or absentAt the edge of the range. Not native disabled, because that would drop focus to the body.
data-disabledpresent or absentAt the edge of the range, for styling.

Calendar.NextMonth

Renders A <button type="button"> with an icon and the name calendar.nextMonth, shown as a tooltip too. It takes every attribute of a <button> and passes ref to it. At the edge of the range it stays focusable and sets aria-disabled. Pass children to replace the icon, and keep any visible text the same as the name (2.5.3 Label in Name).

Class or attributeValuesMeaning
kv-calendar-next-monthalwaysThe part class. The default theme styles it.
aria-disabled"true" or absentAt the edge of the range. Not native disabled, because that would drop focus to the body.
data-disabledpresent or absentAt the edge of the range, for styling.

Calendar.PreviousYear

Renders A <button type="button"> with an icon and the name calendar.previousYear, shown as a tooltip too. It takes every attribute of a <button> and passes ref to it. At the edge of the range it stays focusable and sets aria-disabled. Pass children to replace the icon, and keep any visible text the same as the name (2.5.3 Label in Name).

Class or attributeValuesMeaning
kv-calendar-previous-yearalwaysThe part class. The default theme styles it.
aria-disabled"true" or absentAt the edge of the range. Not native disabled, because that would drop focus to the body.
data-disabledpresent or absentAt the edge of the range, for styling.

Calendar.NextYear

Renders A <button type="button"> with an icon and the name calendar.nextYear, shown as a tooltip too. It takes every attribute of a <button> and passes ref to it. At the edge of the range it stays focusable and sets aria-disabled. Pass children to replace the icon, and keep any visible text the same as the name (2.5.3 Label in Name).

Class or attributeValuesMeaning
kv-calendar-next-yearalwaysThe part class. The default theme styles it.
aria-disabled"true" or absentAt the edge of the range. Not native disabled, because that would drop focus to the body.
data-disabledpresent or absentAt the edge of the range, for styling.

Calendar.RangeHint

Renders A <p> that says which dates can be chosen and, in range mode, the span limits and the next step. It is also the grid’s description. It renders nothing when there is no line to say. It takes every attribute of a <p> and passes ref to it.

Class or attributeValuesMeaning
kv-calendar-rangealwaysThe part class. Its id is the grid’s aria-describedby.
kv-calendar-range-lineon each lineOne span for each line: the dates that can be chosen, the span limits and the next step.

Calendar.Grid

Renders A <table role="grid"> with the weekday headers and the weeks. The focused day is the one Tab stop. It takes every attribute of a <table> and passes ref to it.

PropTypeDefaultDescription
offset0 | 101 for the second month when visibleMonths is 2. Renders nothing while one month shows.
childrenReactNode–Your own rows. Without it the grid renders the weekday headers and the weeks. For your own rows use weeks and getDayProps from useCalendar.
Class or attributeValuesMeaning
kv-calendar-gridalwaysThe part class.
role"grid"On the table.
aria-multiselectable"true" or absentIn range mode, when more than one day is selected.
data-offset0 or 11 on the second month’s grid.
kv-calendar-dayon each day’s cellA td with role="gridcell". Its name is the whole date, whether it is today, its place in a range and your description.
data-todaypresent or absentOn today’s cell. aria-current="date" is on it too.
data-selectedpresent or absentOn the chosen day, with aria-selected="true".
data-unavailablepresent or absentOn a day the user can’t choose. It keeps focus, with aria-disabled="true".
data-outside-rangepresent or absentOn a day before the minimum or after the maximum.
data-range-start, data-range-end, data-in-rangepresent or absentRange mode: the start, the end (both on a one-day range) and the days between.
data-preview, data-preview-endpresent or absentRange mode, drawn only: the days up to the day the pointer or focus is on while the end is pending.

useCalendar

Takes the same options as Calendar.Root. Spread getDayProps(date) on each day’s <td>.

Options

PropTypeDefaultDescription
defaultFocusedDateIsoDateTodayThe day the grid opens on when none is chosen, such as a date the user typed. Read once, when the Calendar mounts.
minimumIsoDate–The first day that can be chosen, as YYYY-MM-DD. The keys and the month buttons stop here. A minimum after the maximum throws a RangeError.
maximumIsoDate–The last day that can be chosen, as YYYY-MM-DD.
isDateUnavailable(date: IsoDate) => boolean–A day inside the range that can’t be chosen. It stays focusable, drawn struck through, with aria-disabled. Say why in getDateDescription.
getDateDescription(date: IsoDate) => string | undefined–Extra words for a day’s name, such as why it is unavailable: "Recycling centre closed".
weekStartWeekStartThe provider’sThe first day of the week, 1 (Monday) to 7 (Sunday). Else the provider’s, else the locale’s when it names a region, else Monday.
weekNumbersbooleanfalseShows the ISO 8601 week number before each week. Only with a Monday start: another start hides them and warns in development.
todayIsoDateThe clockToday as YYYY-MM-DD. Else read from the clock in the provider’s time zone, once, on mount.
announcebooleantrueAnnounces the new month after a month or year button, and what a press did after a day is chosen, through the Announcer. Set false when your own markup says it.
visibleMonths1 | 21The most months side by side. Two show only from 64rem wide, one below it and on the server.
messagesPartial<KvirnMessages['calendar']>–Replaces the Calendar’s strings for this instance.
mode'single' | 'range''single'Single chooses one day. Range chooses a start and an end with two ordinary presses and adds no key. It decides the shape of value, defaultValue and onValueChange.
valueIsoDate | DateRange–Controlled. Single: the chosen day as YYYY-MM-DD, or "" for none. Range: { start, end }, "" for a day not chosen. Pair it with onValueChange.
defaultValueIsoDate | DateRange–Uncontrolled: the day or range chosen at first.
onValueChange(date: IsoDate) => void | (range: DateRange, change: CalendarRangeChange) => void–Single: called with the day when an available day is chosen. Range: called after every press that changed the range, so a start alone is reported at once; change.step is "complete" when the range is finished.
selects'both' | 'start' | 'end''both'Range only. Which end a press sets: both (start, then end), or one end of a from/to pair of Calendars that share one range.
minimumDaysnumber–Range only. The fewest days, counting both ends (a one-day range is 1).
maximumDaysnumber–Range only. The most days, counting both ends. A booking of 14 nights is 15.
allowUnavailableInRangebooleanfalseRange only. Lets a range pass over an unavailable day, such as a leave across a holiday. By default it blocks.
announceChoicebooleantrueAnnounce the press that completes a choice: the day, or the finished range. Set false when something else says it, as a picker does. The month is still announced.

Result

PropTypeDefaultDescription
rootPropsCalendarRootPartProps–Spread on the Root’s element: the class kv-calendar.
headingPropsCalendarHeadingPartProps–The first month’s heading, as months[0]. Its id names the grid.
headingTextstring–The month and year, "October 2026".
previousMonthPropsCalendarStepPartProps–Spread on the button for the month before. It stays focusable at the edge of the range.
nextMonthPropsCalendarStepPartProps–Spread on the button for the month after.
previousYearPropsCalendarStepPartProps–For the optional button that shows the same month a year before.
nextYearPropsCalendarStepPartProps–For the optional button that shows the same month a year after.
rangeHintPropsCalendarRangeHintPartProps–Spread on the paragraph above the grid. Its id is the grid’s description.
rangeHintstring | undefined–The lines in one text. undefined when there is none.
rangeHintLinesstring[]–The lines to show: the minimum and maximum, then in range mode the span limits and the next step.
gridPropsCalendarGridPartProps–The first month’s grid, as months[0]. Spread on the <table>.
weekdaysCalendarWeekday[]–The column headers in the order of the week start, each with a short and a long name.
hasWeekNumbersboolean–Whether a week-number column is shown.
weekHeader{ short: string; long: string }–The header over the week numbers: "Wk" is visible, "Week" is read.
weeksCalendarWeek[]–The weeks of the first visible month, for your own markup.
monthsCalendarMonth[]–The months in view: one, or two side by side. Each has its heading, grid and weeks.
getDayProps(date: IsoDate) => CalendarDayPartProps–The props for the <td> of one day.
visibleMonthYearMonth–The first month in view.
visibleMonths1 | 2–How many months are in view now.
focusedDateIsoDate–The day with the Tab stop.
selectedDateIsoDate | undefined–The chosen day.
rangeDateRange | undefined–Range mode: the range as shown (an end before the start is dropped). undefined in single mode.
rangeStepRangeStep | undefined–Range mode: what the next press does.

Strings

These are the default texts in @kvirn-ui/i18n.

For your whole app, pass messages to KvirnProvider. For one Calendar, pass its messages prop.

Message keyParametersDefault text in EnglishUsed for
previousMonth–Previous monthThe name of the previous-month button.
nextMonth–Next monthThe name of the next-month button.
previousYear–Previous yearThe name of the previous-year button.
nextYear–Next yearThe name of the next-year button.
dayNamedate isToday rangePosition rangeNote descriptionWednesday 14 October 2026, today, start date, 7 days, ClosedA day’s name: the date, then today, its place in a range, the range note (its length, or why it can’t be the end) and your description.
weekHeader–WkThe visible header over the week numbers.
weekHeaderLong–WeekThe same header, read by assistive technology.
weekNameweekWeek 42The name of a week-number cell.
rangeHintmin maxDates from 1 October 2026 to 31 December 2026The line above the grid with the first and last day that can be chosen.
selecteddate14 October 2026 selectedAnnounced after a day is chosen.
visibleMonthsfirst lastNovember 2026 and December 2026Announced after a month button with two months in view.
rangeStart–start dateRange: part of the name of the start day.
rangeEnd–end dateRange: part of the name of the end day.
rangeStartAndEnd–start and end dateRange: part of the name of a one-day range.
rangeLengthdays7 daysRange: the length in days, in a day’s name.
rangeTooShortminimumfewer than 2 daysRange: why a day can’t be the end, in its name.
rangeTooLongmaximummore than 15 daysRange: why a day can’t be the end, in its name.
rangeBlocked–an unavailable day is in betweenRange: an unavailable day is between the start and this day.
rangeBeforeStart–before the start dateRange: this day is before the start.
rangeSpanHintminimum maximum2 to 15 daysRange: the span limits, a line in the hint.
rangeChooseStart–Choose the start date.Range: the next step is the start.
rangeChooseEndstartStart date 14 October 2026. Choose the end date.Range: announced and written after the start is pressed.
rangeSelectedstart end length14 October 2026 to 20 October 2026 selected, 7 daysRange: announced after the end is pressed.
rangeEndSelecteddateEnd date 20 October 2026 selected.Range with selects="end": announced after the end is set.
rangeEndCleared–End date cleared.Range with selects="start": the end was dropped.

Known issues#

  • A controlled value that changes while mounted moves the Tab stop and the visible month to it. A change of minimum or maximum that moves the focused day to another month keeps focus in the grid.
  • "Today" is read once, on mount. A Calendar open across midnight keeps yesterday as today.
  • Without a provider timeZone, the first paint uses the UTC date. Server and hydrated HTML agree; after hydration the grid switches "today" (aria-current="date") to the browser's date, and the Tab stop moves with it while the grid is untouched (nothing chosen, no defaultFocusedDate) and no cell holds DOM focus; DOM focus never moves. A Calendar mounted after hydration starts on the browser's date and does not switch. Pass timeZone on KvirnProvider for the same day on the server and the client. A passed today or a provider timeZone is never changed.
  • Empty cells are aria-hidden. A screen reader's table commands may count fewer cells in the first and last week than the seven columns.

Information: Did you know?

Pass timeZone on KvirnProvider so the server and the browser agree which day is today. Anything else on this list that affects your service belongs in your accessibility statement, with its workaround.

Testing#

The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.

AT + browser + OSAgent checkHuman checkResultNotes
Automated (re-runnable tests)
axe, WCAG 2.2 A and AA, every story, 4 themespassn/apasscalendar.stories.tsx, every story, 4 themes
Markup and ARIA (roles, names, ids, states)pendingn/apendingcalendar.test.tsx has no axe check
Keyboard contract rows (Vitest browser)passn/apass37 rows, each names a test in calendar.test.tsx
Focus order and managementpassn/apasscalendar.test.tsx: keyboard › Tab moves from before the calendar through the month buttons to the grid, one stop
Display modes (forced colours, 320px reflow, text spacing, reduced motion)pendingn/apendingnot in sweepComponents (vite.config.ts), so the four sweep projects do not run its stories
Core (required for beta)
NVDA + Chrome + Windowspendingpendingpending
VoiceOver + Safari + iOSpendingpendingpending
Release (before 1.0 and each minor)
JAWS + Chrome + Windowspendingpendingpending
TalkBack + Chrome + Androidpendingpendingpending
VoiceOver + Safari + macOSpendingpendingpending

Range mode: AT run pending for aria-selected on every day in the range with aria-multiselectable: do screen readers say "selected" on each day, and is it noise? Days outside the range carry no aria-selected="false" (the tested choice, and it keeps the markup small); the AT run decides whether a reader needs it.

Research questions: do screen reader users read the week numbers or find them noise? Is the month announcement heard after a button press, and does the day name give enough on a key that crosses a month? Is an empty gridcell skipped or announced as blank?