Skip to main content
Kobalte

Calendar

Since v2.0.0@kobalte/core/calendarSource

A date grid that lets users select a single date, multiple dates, or a date range by clicking (or navigating with the keyboard to) cells in a month view.

Date math, formatting, and keyboard navigation are ported from Adobe's @react-stately/calendar and @react-aria/calendar (Apache-2.0). Range selection follows corvu's click-only model instead — the first click sets the start of the range and the second click commits the end, with no pointer-drag selection — adapted from corvu/calendar's CellTrigger by Jasmin Noetzli (MIT).

Import

import { Calendar } from "@kobalte/core/calendar";
// or
import {
Root,
Body,
Grid,
GridBody,
GridBodyCell,
GridBodyCellTrigger,
GridBodyRow,
GridHeader,
GridHeaderCell,
GridHeaderRow,
Header,
Heading,
NextTrigger,
PrevTrigger,
} from "@kobalte/core/calendar";

Features

  • Single, multiple, or range date selection via the selectionMode prop.
  • Values are native JS Date objects (Gregorian calendar only) rather than a separate date library's types.
  • Click-only range selection — no pointer-drag tracking — see the corvu credit above.
  • Can be controlled (value / onChange) or uncontrolled (defaultValue).
  • minValue, maxValue, and isDateUnavailable to constrain selectable dates.
  • allowsNonContiguousRanges to allow a range to skip over unavailable dates.
  • Independently controllable focused date (focusedValue / defaultFocusedValue / onFocusChange).
  • Full internationalization (locale-aware month/weekday names, first day of week, RTL) via translations and Kobalte's i18n context.
  • Full keyboard navigation between cells, months, and years.
  • disabled and readOnly states.
  • Automatic live-region announcements when the visible range or selection changes.
  • Date arithmetic (day/week/month navigation) runs in the browser's local time zone; there's no explicit per-value time zone tracking, so operations that cross a daylight-saving transition follow the local system clock.

Anatomy

The calendar consists of:

  • Calendar: The root container that manages selection, focus, and pagination state.
  • Calendar.Header: Contains the heading and the previous/next navigation triggers.
  • Calendar.PrevTrigger: A button that navigates to the previous page (month/year).
  • Calendar.Heading: Displays the current visible date range (e.g. the month and year).
  • Calendar.NextTrigger: A button that navigates to the next page.
  • Calendar.Body: Contains one or more calendar grids.
  • Calendar.Grid: A single grid of days for a month, keyboard navigable and selectable.
  • Calendar.GridHeader: The row of weekday names at the top of a grid.
  • Calendar.GridHeaderRow: A row rendering each weekday name.
  • Calendar.GridHeaderCell: A single weekday name cell.
  • Calendar.GridBody: The rows of day cells for a month.
  • Calendar.GridBodyRow: A single week row of day cells.
  • Calendar.GridBodyCell: A single day cell, tracking selected/disabled/unavailable state for the date it represents.
  • Calendar.GridBodyCellTrigger: The clickable/focusable element inside a cell that performs the actual selection.
<Calendar>
<Calendar.Header>
<Calendar.PrevTrigger />
<Calendar.Heading />
<Calendar.NextTrigger />
</Calendar.Header>
<Calendar.Body>
<Calendar.Grid>
<Calendar.GridHeader>
<Calendar.GridHeaderRow>
{weekDay => <Calendar.GridHeaderCell>{weekDay()}</Calendar.GridHeaderCell>}
</Calendar.GridHeaderRow>
</Calendar.GridHeader>
<Calendar.GridBody>
{weekIndex => (
<Calendar.GridBodyRow weekIndex={weekIndex()}>
{date => (
<Calendar.GridBodyCell date={date()!}>
<Calendar.GridBodyCellTrigger />
</Calendar.GridBodyCell>
)}
</Calendar.GridBodyRow>
)}
</Calendar.GridBody>
</Calendar.Grid>
</Calendar.Body>
</Calendar>

Example

November 2026

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
1
2
3
4
5
export function BasicExample() {
return (
<Calendar selectionMode="single" class={style.calendar}>
<Calendar.Header class={style.calendar__header}>
<Calendar.PrevTrigger class={style.calendar__trigger}>
{"<"}
</Calendar.PrevTrigger>
<Calendar.Heading class={style.calendar__heading} />
<Calendar.NextTrigger class={style.calendar__trigger}>
{">"}
</Calendar.NextTrigger>
</Calendar.Header>
<Calendar.Body>
<Calendar.Grid class={style.calendar__grid}>
<Calendar.GridHeader>
<Calendar.GridHeaderRow>
{(weekDay) => (
<Calendar.GridHeaderCell
class={style["calendar__grid-header-cell"]}
>
{weekDay()}
</Calendar.GridHeaderCell>
)}
</Calendar.GridHeaderRow>
</Calendar.GridHeader>
<Calendar.GridBody>
{(weekIndex) => (
<Calendar.GridBodyRow weekIndex={weekIndex()}>
{(date) => (
<Show
when={date()}
fallback={<td class={style["calendar__grid-body-cell"]} />}
>
<Calendar.GridBodyCell
date={date()!}
class={style["calendar__grid-body-cell"]}
>
<Calendar.GridBodyCellTrigger
class={style["calendar__grid-body-cell-trigger"]}
/>
</Calendar.GridBodyCell>
</Show>
)}
</Calendar.GridBodyRow>
)}
</Calendar.GridBody>
</Calendar.Grid>
</Calendar.Body>
</Calendar>
);
}
.calendar {
display: inline-flex;
flex-direction: column;
gap: 8px;
padding: 8px;
border-radius: 6px;
background-color: #fff;
border: 1px solid hsl(240 6% 90%);
color: hsl(240 4% 16%);
font-size: 14px;
}
.calendar[data-disabled] {
opacity: 0.5;
}
.calendar__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 4px;
}
.calendar__heading {
font-size: 14px;
font-weight: 500;
margin: 0;
}
.calendar__trigger {
appearance: none;
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border-radius: 6px;
border: 1px solid hsl(240 6% 90%);
background-color: #fff;
color: hsl(240 4% 16%);
cursor: pointer;
}
.calendar__trigger:hover {
background-color: hsl(240 5% 96%);
}
.calendar__trigger[disabled] {
opacity: 0.4;
cursor: not-allowed;
}
.calendar__grid {
border-collapse: collapse;
}
.calendar__grid-header-cell {
font-size: 12px;
font-weight: 500;
color: hsl(240 4% 46%);
padding: 4px;
text-align: center;
}
.calendar__grid-body-cell {
padding: 2px;
text-align: center;
}
.calendar__grid-body-cell-trigger {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 6px;
outline: none;
cursor: pointer;
user-select: none;
}
.calendar__grid-body-cell-trigger[data-outside-month] {
color: hsl(240 5% 65%);
}
.calendar__grid-body-cell-trigger[data-today] {
font-weight: 700;
}
.calendar__grid-body-cell-trigger[data-highlighted] {
outline: 2px solid hsl(200 98% 39%);
outline-offset: -1px;
}
.calendar__grid-body-cell-trigger[data-selected] {
background-color: hsl(200 98% 39%);
color: #fff;
}
.calendar__grid-body-cell-trigger[data-selection-start],
.calendar__grid-body-cell-trigger[data-selection-end] {
background-color: hsl(200 98% 39%);
color: #fff;
}
.calendar__grid-body-cell-trigger[data-disabled],
.calendar__grid-body-cell-trigger[data-unavailable] {
color: hsl(240 5% 65%);
opacity: 0.5;
cursor: not-allowed;
text-decoration: line-through;
}
.calendar__grid-body-cell-trigger[data-weekend]:not([data-outside-month]) {
color: hsl(0 72% 51%);
}
[data-theme*="dark"] .calendar {
background-color: hsl(240 4% 16%);
border: 1px solid hsl(240 5% 34%);
color: hsl(0 100% 100% / 0.9);
}
[data-theme*="dark"] .calendar__trigger {
background-color: hsl(240 4% 16%);
border: 1px solid hsl(240 5% 34%);
color: hsl(0 100% 100% / 0.9);
}
[data-theme*="dark"] .calendar__trigger:hover {
background-color: hsl(240 5% 26%);
}
[data-theme*="dark"] .calendar__grid-header-cell {
color: hsl(240 5% 65%);
}
[data-theme*="dark"] .calendar__grid-body-cell-trigger[data-outside-month] {
color: hsl(240 5% 45%);
}
[data-theme*="dark"] .calendar__grid-body-cell-trigger[data-disabled],
[data-theme*="dark"] .calendar__grid-body-cell-trigger[data-unavailable] {
color: hsl(240 5% 45%);
}

Usage

Multiple selection

Set selectionMode="multiple" to let the user toggle any number of individual dates. value / defaultValue become a DateValue[] | null, and clicking an already-selected date removes it.

November 2026

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
1
2
3
4
5
<Calendar selectionMode="multiple">{/* ...anatomy... */}</Calendar>

Range selection

Set selectionMode="range" to select a contiguous range of dates. value / defaultValue become a RangeValue<DateValue> | null (an object with start and end).

Selection is click-only, following corvu's model: the first click on a cell sets the range's start and becomes the "anchor" — Calendar.GridBodyCellTrigger exposes this cell via data-selection-start/data-selection-end, and every date between the anchor and the currently focused/hovered date is highlighted via data-selected. The second click commits the range's end and clears the anchor. Pressing Escape while an anchor is set cancels the in-progress range. There is no pointer-drag selection.

November 2026

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
1
2
3
4
5
<Calendar selectionMode="range">{/* ...anatomy... */}</Calendar>

Controlled value

Use value and onChange to control the selected date yourself. Values are native Date objects, so any native Date method or formatter (e.g. toLocaleDateString(), Intl.DateTimeFormat) works directly — no separate date library is involved.

January 2024

31
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
1
2
3

Selected date: 1/15/2024

import { Calendar, type DateValue } from "@kobalte/core/calendar";
import { createSignal, Show } from "solid-js";
function ControlledExample() {
const [value, setValue] = createSignal<DateValue | null>(new Date(2024, 0, 15));
return (
<>
<Calendar selectionMode="single" value={value()} onChange={setValue}>
{/* ...anatomy... */}
</Calendar>
<p>
Selected date:{" "}
<Show when={value()} fallback="--">
{value()!.toLocaleDateString()}
</Show>
</p>
</>
);
}

Min and max dates

Use minValue and maxValue to constrain the selectable range. Cells outside the range become disabled and Calendar.PrevTrigger / Calendar.NextTrigger disable themselves once no further page contains a selectable date. defaultFocusedValue sets which date is initially focused.

January 2024

31
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
1
2
3
<Calendar
selectionMode="single"
defaultFocusedValue={new Date(2024, 0, 15)}
minValue={new Date(2024, 0, 5)}
maxValue={new Date(2024, 0, 25)}
>
{/* ...anatomy... */}
</Calendar>

Disabled

Set disabled on the root to disable the whole calendar. Every cell becomes non-selectable, the root exposes data-disabled for styling, and the calendar remains focusable/navigable for assistive technology unless you also remove it from the tab order.

November 2026

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
1
2
3
4
5
<Calendar selectionMode="single" disabled>
{/* ...anatomy... */}
</Calendar>

Unavailable dates

Use isDateUnavailable to mark specific dates as unavailable without disabling the whole calendar. Unavailable cells expose data-unavailable and cannot be selected, but they're still visible (unlike dates outside minValue/maxValue, which are simply disabled).

November 2026

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
1
2
3
4
5
function isDateUnavailable(date: DateValue) {
return date.getDate() % 7 === 0;
}
<Calendar selectionMode="single" isDateUnavailable={isDateUnavailable}>
{/* ...anatomy... */}
</Calendar>;

In "range" mode, combine this with allowsNonContiguousRanges to control whether a selected range is allowed to skip over unavailable dates (defaults to requiring a contiguous, fully-available range).

API Reference

Calendar

Calendar is equivalent to the Root import from @kobalte/core/calendar.

Its props are a discriminated union keyed by the required selectionMode prop.

Common props

PropDescription
translationsCalendarIntlTranslations
The localized strings of the component.
localestring
The locale to display and edit the value according to. Defaults to the ambient Kobalte i18n locale.
visibleDurationDateDuration
The amount of days/months/years visible at once. Affects pagination. Default: { months: 1 }
selectionAlignment"start" | "center" | "end"
How to align the initial selection relative to the visible date range.
minValueDateValue
The minimum allowed date that a user may select.
maxValueDateValue
The maximum allowed date that a user may select.
isDateUnavailable(date: DateValue) => boolean
Called for each date; returning true marks it unavailable.
allowsNonContiguousRangesboolean
In "range" mode, combined with isDateUnavailable, whether a range may contain unavailable dates.
autoFocusboolean
Whether to automatically focus the calendar when it mounts.
focusedValueDateValue
Controls the currently focused date.
defaultFocusedValueDateValue
The date focused when the calendar first mounts.
onFocusChange(date: DateValue) => void
Called when the focused date changes.
validationState"valid" | "invalid"
Whether the current selection is valid or invalid according to application logic.
disabledboolean
Whether the calendar is disabled.
readOnlyboolean
Whether the calendar value is read only.

selectionMode="single"

PropDescription
selectionMode"single"
(required)
valueDateValue | null
The controlled selected date.
defaultValueDateValue | null
The date selected when initially rendered (uncontrolled).
onChange(value: DateValue) => void
Called when the selected date changes.

selectionMode="multiple"

PropDescription
selectionMode"multiple"
(required)
valueDateValue[] | null
The controlled selected dates.
defaultValueDateValue[] | null
The dates selected when initially rendered (uncontrolled).
onChange(value: DateValue[]) => void
Called when the selected dates change.

selectionMode="range"

PropDescription
selectionMode"range"
(required)
valueRangeValue<DateValue> | null
The controlled selected date range ({ start, end }).
defaultValueRangeValue<DateValue> | null
The range selected when initially rendered (uncontrolled).
onChange(value: RangeValue<DateValue>) => void
Called when the selected date range changes.
Data attributeDescription
data-disabledPresent when the calendar is disabled.
data-readonlyPresent when the calendar value is read only.

Calendar is the root of a picker widget rather than a form field, so it has no data-valid/data-invalid/data-required — validationState is instead surfaced on individual Calendar.GridBodyCellTrigger elements (see below).

Calendar.Header

No additional props. Contains the heading and navigation triggers.

Calendar.Heading

No additional props. Displays a formatted label of the current visible range (e.g. "January 2024"), derived from the calendar's locale and translations.

Calendar.PrevTrigger / Calendar.NextTrigger

Both extend Button.Root's props/behavior and are automatically disabled — moving focus to the calendar body — when navigating further would go past minValue / maxValue.

PropDescription
disabledboolean
Whether the trigger is disabled, in addition to the automatic min/max-based disabling.

Calendar.Body

No additional props. Contains one or more Calendar.Grids.

Calendar.Grid

PropDescription
offsetDateDuration
An offset from the beginning of the visible range this grid should display. Useful when rendering more than one month at a time.
weekDayFormat"narrow" | "short" | "long"
The format of weekday names in Calendar.GridHeader. Default: "short"
Data attributeDescription
role="grid"ARIA role.
aria-readonly"true" when the calendar is read only.
aria-disabled"true" when the calendar is disabled.
aria-multiselectable"true" unless selectionMode is "single".

Calendar.GridHeader

No additional props. Renders as <thead aria-hidden="true"> — weekday names are decorative; the accessible label comes from each cell's own aria-label.

Calendar.GridHeaderRow

PropDescription
children(weekDay: Accessor<string>) => JSX.Element
Render prop called once per weekday, receiving its localized name.

Calendar.GridHeaderCell

No additional props. Renders a single weekday name cell (<th>).

Calendar.GridBody

PropDescription
children(weekIndex: Accessor<number>) => JSX.Element
Render prop called once per week row in the month.

Calendar.GridBodyRow

PropDescription
weekIndexnumber
The index of the week to render.
children(date: Accessor<DateValue | null>) => JSX.Element
Render prop called once per day in the week. The date accessor type still allows null, kept for backward compatibility, but never returns it in practice.

Calendar.GridBodyCell

PropDescription
dateDateValue
(required) The date this cell represents.
disabledboolean
Whether the cell is disabled, in addition to the automatic minValue/maxValue/disabled-based disabling.
Data attributeDescription
role="gridcell"ARIA role.
aria-disabled"true" when the cell isn't selectable.
aria-selected"true" when the cell's date is selected.
aria-invalid"true" when the cell's date is selected and invalid.
aria-current"date" when the cell's date is today.
data-valueThe ISO 8601 string of the cell's date.

Calendar.GridBodyCellTrigger

The interactive element inside a Calendar.GridBodyCell; selects its date on click or on Enter/Space.

PropDescription
disabledboolean
Whether the cell trigger is disabled, in addition to the cell's own disabled state.
Data attributeDescription
data-disabledPresent when the cell is disabled.
data-invalidPresent when the cell's date is selected and invalid.
data-selectedPresent when the cell's date is selected (or inside the highlighted range in "range" mode).
data-valueThe ISO 8601 string of the cell's date.
data-typeAlways "day".
data-todayPresent when the cell's date is today.
data-weekendPresent when the cell's date falls on a weekend (locale-aware).
data-highlightedPresent when the cell's date is the currently focused date.
data-unavailablePresent when the cell's date was marked unavailable by isDateUnavailable.
data-selection-startIn "range" mode, present on the cell that starts the selected/highlighted range.
data-selection-endIn "range" mode, present on the cell that ends the selected/highlighted range.
data-outside-visible-rangePresent when the cell's date falls outside the grid's visible date range.
data-outside-monthPresent when the cell's date falls outside the grid's current month.

Rendered elements

ComponentDefault rendered element
Calendardiv
Calendar.Headerheader
Calendar.Headingh2
Calendar.PrevTriggerbutton
Calendar.NextTriggerbutton
Calendar.Bodydiv
Calendar.Gridtable
Calendar.GridHeaderthead
Calendar.GridHeaderRowtr
Calendar.GridHeaderCellth
Calendar.GridBodytbody
Calendar.GridBodyRowtr
Calendar.GridBodyCelltd
Calendar.GridBodyCellTriggerdiv

Accessibility

Keyboard Interactions

Keyboard interactions are handled by Calendar.Grid, which must be focused (e.g. via the currently highlighted cell) for the following to apply.

KeyDescription
Enter / SpaceSelects the focused date.
ArrowLeft / ArrowRightMoves focus to the previous/next day (flipped in RTL locales).
ArrowUp / ArrowDownMoves focus to the same day in the previous/next week.
PageUp / PageDownMoves focus to the same day in the previous/next month.
Shift + PageUp / PageDownMoves focus to the same day in the previous/next year.
HomeMoves focus to the first day of the current month.
EndMoves focus to the last day of the current month.
EscapeIn "range" mode, cancels an in-progress range selection (clears the anchor date).

Range selection's click-only interaction model — first click sets the start, second click commits the end — is adapted from corvu/calendar by Jasmin Noetzli (MIT).

Last updated: 11/28/26, 9:28 PM