Calendar
import { CaretLeft, CaretRight } from '@examples/primitives/calendar/icons'
import Calendar from '@corvu/calendar'
import { Index } from 'solid-js'
import type { VoidComponent } from 'solid-js'
const CalendarExample: VoidComponent = () => {
return (
<div>
<Calendar mode="single">
{(props) => (
<div class="my-4 rounded-md bg-corvu-100 p-3 shadow-md md:my-8">
<div class="flex items-center justify-between gap-4">
<Calendar.Nav
action="prev-month"
aria-label="Go to previous month"
class="size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretLeft size="18" />
</Calendar.Nav>
<Calendar.Label class="text-sm">
{formatMonth(props.month)} {props.month.getFullYear()}
</Calendar.Label>
<Calendar.Nav
action="next-month"
aria-label="Go to next month"
class="size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretRight size="18" />
</Calendar.Nav>
</div>
<Calendar.Table class="mt-3">
<thead>
<tr>
<Index each={props.weekdays}>
{(weekday) => (
<Calendar.HeadCell
abbr={formatWeekdayLong(weekday())}
class="w-8 flex-1 pb-1 text-xs font-normal opacity-50"
>
{formatWeekdayShort(weekday())}
</Calendar.HeadCell>
)}
</Index>
</tr>
</thead>
<tbody>
<Index each={props.weeks}>
{(week) => (
<tr>
<Index each={week()}>
{(day) => (
<Calendar.Cell class="p-0">
<Calendar.CellTrigger
day={day()}
class="inline-flex size-8 items-center justify-center rounded-md text-sm focus-visible:bg-corvu-200/80 disabled:pointer-events-none disabled:opacity-40 corvu-selected:!bg-corvu-300 corvu-today:bg-corvu-200/50 lg:hover:bg-corvu-200/80"
>
{day().getDate()}
</Calendar.CellTrigger>
</Calendar.Cell>
)}
</Index>
</tr>
)}
</Index>
</tbody>
</Calendar.Table>
</div>
)}
</Calendar>
</div>
)
}
const { format: formatWeekdayLong } = new Intl.DateTimeFormat('en', {
weekday: 'long',
})
const { format: formatWeekdayShort } = new Intl.DateTimeFormat('en', {
weekday: 'short',
})
const { format: formatMonth } = new Intl.DateTimeFormat('en', {
month: 'long',
})
export default CalendarExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Features Section titled Features
- Supports single, multiple and range selection
- Full keyboard navigation
- Focus management of the calendar cells
Installation Section titled Installation
npm install @corvu/calendar
The calendar is also included in the main corvu
package under corvu/calendar
.
Usage Section titled Usage
import Calendar from '@corvu/calendar' // 'corvu/calendar'
// or
// import { Root, Nav, ... } from '@corvu/calendar'
Anatomy Section titled Anatomy
<Calendar>
<Calendar.Nav action="prev-month" />
<Calendar.Label />
<Calendar.Nav action="next-month" />
<Calendar.Table>
<thead>
<tr>
<Index each={props.weekdays}>
{(weekday) => (
<Calendar.HeadCell />
)}
</Index>
</tr>
</thead>
<tbody>
<Index each={props.weeks}>
{(week) => (
<tr>
<Index each={week()}>
{(day) => (
<Calendar.Cell day={day()}>
<Calendar.CellTrigger day={day()} />
</Calendar.Cell>
)}
</Index>
</tr>
)}
</Index>
</tbody>
</Calendar.Table>
</Calendar>
Philosophy Section titled Philosophy
This calendar is designed to be simple and lightweight. It handles functionality and accessibility to cover the common use cases but leaves things like internationalization and more individual behavior up to the user to implement. If you feel like a crucial functionality or feature is missing that is difficult or impossible to implement in userland, feel free to open an issue in the corvu Github repository.
Usage with SSR/SSG Section titled Usage with SSR/SSG
It is important to be aware of potential hydration mismatches when rendering the calendar on the server.
Make sure to set initialFocusedDay
and initialMonth
manually to avoid using new Date()
as default, as this can lead to hydration errors due to different timezones (or even due to the delay between server and client).
Examples Section titled Examples
Range selection Section titled Range selection
Use mode="range"
to set the selection mode to range. By defining numberOfMonths={2}
we can display two months at once:
import { CaretLeft, CaretRight } from '@examples/primitives/calendar/icons'
import Calendar from '@corvu/calendar'
import { Index } from 'solid-js'
import type { VoidComponent } from 'solid-js'
const CalendarExample: VoidComponent = () => {
return (
<div>
<Calendar mode="range" numberOfMonths={2}>
{(props) => (
<div class="relative my-4 rounded-md bg-corvu-100 p-3 shadow-md md:my-8">
<Calendar.Nav
action="prev-month"
aria-label="Go to previous month"
class="absolute left-3 size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretLeft size="18" />
</Calendar.Nav>
<Calendar.Nav
action="next-month"
aria-label="Go to next month"
class="absolute right-3 size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretRight size="18" />
</Calendar.Nav>
<div class="space-y-4 md:flex md:space-x-4 md:space-y-0">
<Index each={props.months}>
{(month, index) => (
<div>
<div class="flex h-7 items-center justify-center">
<Calendar.Label index={index} class="text-sm">
{formatMonth(month().month)}{' '}
{month().month.getFullYear()}
</Calendar.Label>
</div>
<Calendar.Table index={index} class="mt-3">
<thead>
<tr>
<Index each={props.weekdays}>
{(weekday) => (
<Calendar.HeadCell
abbr={formatWeekdayLong(weekday())}
class="w-8 flex-1 pb-1 text-xs font-normal opacity-50"
>
{formatWeekdayShort(weekday())}
</Calendar.HeadCell>
)}
</Index>
</tr>
</thead>
<tbody>
<Index each={month().weeks}>
{(week) => (
<tr>
<Index each={week()}>
{(day) => (
<Calendar.Cell class="p-0">
<Calendar.CellTrigger
day={day()}
month={month().month}
class="inline-flex size-8 items-center justify-center rounded-md text-sm focus-visible:bg-corvu-200/80 disabled:pointer-events-none disabled:opacity-40 corvu-selected:!bg-corvu-300 corvu-today:bg-corvu-200/50 lg:hover:bg-corvu-200/80"
>
{day().getDate()}
</Calendar.CellTrigger>
</Calendar.Cell>
)}
</Index>
</tr>
)}
</Index>
</tbody>
</Calendar.Table>
</div>
)}
</Index>
</div>
</div>
)}
</Calendar>
</div>
)
}
const { format: formatWeekdayLong } = new Intl.DateTimeFormat('en', {
weekday: 'long',
})
const { format: formatWeekdayShort } = new Intl.DateTimeFormat('en', {
weekday: 'short',
})
const { format: formatMonth } = new Intl.DateTimeFormat('en', {
month: 'long',
})
export default CalendarExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Disabling dates Section titled Disabling dates
You can disable specific dates by passing a callback to the disabled
prop. This function receives the date as an argument and should return a boolean.
This function is reactive, meaning you can access signals and it will update the calendar when any of it’s dependencies change.
<Calendar
// Disable weekends
disabled={(date) => date.getDay() === 0 || date.getDay() === 6}
/>
import { CaretLeft, CaretRight } from '@examples/primitives/calendar/icons'
import Calendar from '@corvu/calendar'
import { Index } from 'solid-js'
import type { VoidComponent } from 'solid-js'
const CalendarExample: VoidComponent = () => {
return (
<div>
<Calendar
mode="single"
disabled={(day) => day.getDay() === 0 || day.getDay() === 6}
>
{(props) => (
<div class="my-4 rounded-md bg-corvu-100 p-3 shadow-md md:my-8">
<div class="flex items-center justify-between gap-4">
<Calendar.Nav
action="prev-month"
aria-label="Go to previous month"
class="size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretLeft size="18" />
</Calendar.Nav>
<Calendar.Label class="text-sm">
{formatMonth(props.month)} {props.month.getFullYear()}
</Calendar.Label>
<Calendar.Nav
action="next-month"
aria-label="Go to next month"
class="size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretRight size="18" />
</Calendar.Nav>
</div>
<Calendar.Table class="mt-3">
<thead>
<tr>
<Index each={props.weekdays}>
{(weekday) => (
<Calendar.HeadCell
abbr={formatWeekdayLong(weekday())}
class="w-8 flex-1 pb-1 text-xs font-normal opacity-50"
>
{formatWeekdayShort(weekday())}
</Calendar.HeadCell>
)}
</Index>
</tr>
</thead>
<tbody>
<Index each={props.weeks}>
{(week) => (
<tr>
<Index each={week()}>
{(day) => (
<Calendar.Cell class="p-0">
<Calendar.CellTrigger
day={day()}
class="inline-flex size-8 items-center justify-center rounded-md text-sm focus-visible:bg-corvu-200/80 disabled:pointer-events-none disabled:opacity-40 corvu-selected:!bg-corvu-300 corvu-today:bg-corvu-200/50 lg:hover:bg-corvu-200/80"
>
{day().getDate()}
</Calendar.CellTrigger>
</Calendar.Cell>
)}
</Index>
</tr>
)}
</Index>
</tbody>
</Calendar.Table>
</div>
)}
</Calendar>
</div>
)
}
const { format: formatWeekdayLong } = new Intl.DateTimeFormat('en', {
weekday: 'long',
})
const { format: formatWeekdayShort } = new Intl.DateTimeFormat('en', {
weekday: 'short',
})
const { format: formatMonth } = new Intl.DateTimeFormat('en', {
month: 'long',
})
export default CalendarExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Date Picker Section titled Date Picker
We can combine the calendar with the Popover primitive to create a date picker:
import {
CalendarBlank,
CaretLeft,
CaretRight,
} from '@examples/primitives/calendar/icons'
import { createUniqueId, Index, Show } from 'solid-js'
import Calendar from '@corvu/calendar'
import Popover from '@corvu/popover'
import type { VoidComponent } from 'solid-js'
const CalendarExample: VoidComponent = () => {
const labelId = createUniqueId()
return (
<Calendar mode="single" labelIds={[labelId]}>
{(props) => (
<Popover
placement="bottom-start"
floatingOptions={{
offset: 5,
flip: true,
}}
labelId={labelId}
>
<Popover.Trigger class="my-auto flex w-56 items-center space-x-2 rounded-md bg-corvu-100 px-3 py-2 transition-all duration-100 hover:bg-corvu-200">
<CalendarBlank size="20" />
<Show when={props.value} fallback={<span>Pick a date</span>}>
<span>{formatTrigger(props.value!)}</span>
</Show>
</Popover.Trigger>
<Popover.Portal>
<Popover.Content class="z-50 rounded-lg bg-corvu-100 shadow-md corvu-open:animate-in corvu-open:fade-in-50 corvu-open:slide-in-from-top-1 corvu-closed:animate-out corvu-closed:fade-out-50 corvu-closed:slide-out-to-top-1">
<div class="rounded-md bg-corvu-100 p-3 shadow-md">
<div class="flex items-center justify-between gap-4">
<Calendar.Nav
action="prev-month"
aria-label="Go to previous month"
class="size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretLeft size="18" />
</Calendar.Nav>
<Calendar.Label as={Popover.Label} class="text-sm">
{formatMonth(props.month)} {props.month.getFullYear()}
</Calendar.Label>
<Calendar.Nav
action="next-month"
aria-label="Go to next month"
class="size-7 rounded bg-corvu-200/50 p-[5px] hover:bg-corvu-200"
>
<CaretRight size="18" />
</Calendar.Nav>
</div>
<Calendar.Table class="mt-3">
<thead>
<tr>
<Index each={props.weekdays}>
{(weekday) => (
<Calendar.HeadCell
abbr={formatWeekdayLong(weekday())}
class="w-8 flex-1 pb-1 text-xs font-normal opacity-50"
>
{formatWeekdayShort(weekday())}
</Calendar.HeadCell>
)}
</Index>
</tr>
</thead>
<tbody>
<Index each={props.weeks}>
{(week) => (
<tr>
<Index each={week()}>
{(day) => (
<Calendar.Cell class="p-0">
<Calendar.CellTrigger
day={day()}
class="inline-flex size-8 items-center justify-center rounded-md text-sm focus-visible:bg-corvu-200/80 disabled:pointer-events-none disabled:opacity-40 corvu-selected:!bg-corvu-300 corvu-today:bg-corvu-200/50 lg:hover:bg-corvu-200/80"
>
{day().getDate()}
</Calendar.CellTrigger>
</Calendar.Cell>
)}
</Index>
</tr>
)}
</Index>
</tbody>
</Calendar.Table>
</div>
</Popover.Content>
</Popover.Portal>
</Popover>
)}
</Calendar>
)
}
const { format: formatWeekdayLong } = new Intl.DateTimeFormat('en', {
weekday: 'long',
})
const { format: formatWeekdayShort } = new Intl.DateTimeFormat('en', {
weekday: 'short',
})
const { format: formatMonth } = new Intl.DateTimeFormat('en', {
month: 'long',
})
const { format: formatTrigger } = new Intl.DateTimeFormat('en', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
export default CalendarExample
import animatePlugin from 'tailwindcss-animate'
import corvuPlugin from '@corvu/tailwind'
import formsPlugin from '@tailwindcss/forms'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
corvu: {
bg: '#f3f1fe',
100: '#e6e2fd',
200: '#d4cbfb',
300: '#bcacf6',
400: '#a888f1',
text: '#180f24',
},
},
},
},
plugins: [animatePlugin, corvuPlugin, formsPlugin],
}
Accessibility Section titled Accessibility
Adheres to the calendar part of the Date Picker Dialog WAI-ARIA design pattern.
Accessible nav buttons Section titled Accessible nav buttons
Make sure to describe the purpose of the navigation buttons using the aria-label
attribute if they only contain non-text elements:
<Calendar.Nav
action="prev-month"
aria-label="Go to previous month"
>
<CaretLeft size="18" />
</Calendar.Nav>
Keyboard navigation Section titled Keyboard navigation
Key | Behavior |
---|---|
Space | Selects the focused day. |
Enter | Selects the focused day. |
ArrowRight | Moves focus to the previous day. |
ArrowLeft | Moves focus to the next day. |
ArrowUp | Moves focus to the same day of the previous week. |
ArrowDown | Moves focus to the same day of the next week. |
Home | Moves focus to the first day of the week. |
End | Moves focus to the last day of the week. |
PageUp | Moves focus to the same day of the previous month. |
PageDown | Moves focus to the same day of the next month. |
Shift + PageUp | Moves focus to the same day of the previous year. |
Shift + PageDown | Moves focus to the same day of the next year. |
API reference Section titled API reference
Context wrapper for the calendar. Is required for every calendar you create.
Props
Property | Default | Type/Description |
---|---|---|
mode | - | 'single' | 'multiple' | 'range' The mode of the calendar. |
value | - | Date | null | Date[] | { from: Date | null, to: Date | null, } The value of the calendar. |
onValueChange | - | (value: Date | null) => void | (value: Date[]) => void | (value: { from: Date | null, to: Date | null, }) => void Callback fired when the value changes. |
initialValue | null | Date | null | Date[] | { from: Date | null, to: Date | null, } The initial value of the calendar. |
month | - | Date The month to display in the calendar. Is always the first month if multiple months are displayed. |
onMonthChange | - | (month: Date) => void Callback fired when the month changes. |
initialMonth | new Date() | Date The initial month to display in the calendar. |
focusedDay | - | Date The day that is currently focused in the calendar grid. |
onFocusedDayChange | - | (focusedDay: Date) => void Callback fired when the focused day changes. |
initialFocusedDay | new Date() | Date The initial date that should be focused in the calendar grid. |
startOfWeek | 1 | number The first day of the week. (0-6, 0 is Sunday) |
required | false | boolean Whether the value is required. Prevents unselecting the value. |
disabled | - | (day: Date) => boolean Callback to determine if any given day is disabled. |
numberOfMonths | 1 | number The number of months to display in the calendar. |
disableOutsideDays | true | boolean Whether to disable outside days (Days falling in the previous or next month). |
fixedWeeks | false | boolean Whether to always display 6 weeks in a month. |
textDirection | ltr | 'ltr' | 'rtl' The text direction of the calendar. |
min | null | number | null The minimum number of days that have to be selected. |
max | null | number | null The maximum number of days that can be selected. |
excludeDisabled | false | boolean Whether to reset the range selection if a disabled day is included in the range. |
labelIds | createUniqueId() | string[] The id attribute of the calendar label element(s). There can be multiple labels for each month that is being displayed. |
contextId | - | string The id of the calendar context. Useful if you have nested calendars and want to create components that belong to a calendar higher up in the tree. |
Label element to announce the calendar to accessibility tools.
Props
Property | Default | Type/Description |
---|---|---|
index | - | number The index of the calendar table that this label is describing. Is optional as it's not required if only one month is rendered. |
as | h2 | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the calendar context to use. |
Data attributes
Data attributes present on <Label />
components.
Property | Description |
---|---|
data-corvu-calendar-label | Present on every calendar label element. |
Button to navigate the calendar.
Props
Property | Default | Type/Description |
---|---|---|
action | - | `${'prev' | 'next'}-${'month' | 'year'}` | (date: Date) => Date The action to perform when pressing this navigation button. |
as | button | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the calendar context to use. |
Data attributes
Data attributes present on <Nav />
components.
Property | Description |
---|---|
data-corvu-calendar-nav | Present on every calendar nav element. |
Table element for the calendar grid.
Props
Property | Default | Type/Description |
---|---|---|
index | - | number The index of this calendar table. Is optional as it's not required if only one month is rendered. |
as | table | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the calendar context to use. |
Data attributes
Data attributes present on <Table />
components.
Property | Description |
---|---|
data-corvu-calendar-table | Present on every calendar table element. |
Calendar column header cell.
Props
Property | Default | Type/Description |
---|---|---|
as | th | ValidComponent Component to render the dynamic component as. |
Data attributes
Data attributes present on <HeadCell />
components.
Property | Description |
---|---|
data-corvu-calendar-headcell | Present on every calendar headcell element. |
Calendar cell element.
Props
Property | Default | Type/Description |
---|---|---|
as | td | ValidComponent Component to render the dynamic component as. |
Data attributes
Data attributes present on <Cell />
components.
Property | Description |
---|---|
data-corvu-calendar-cell | Present on every calendar cell element. |
Button that selectes a day in the calendar.
Props
Property | Default | Type/Description |
---|---|---|
day | - | Date |
month | - | Date The month that this cell trigger belongs to. Is optional as it's not required if only one month is rendered. |
as | button | ValidComponent Component to render the dynamic component as. |
contextId | - | string The id of the calendar context to use. |
Data attributes
Data attributes present on <CellTrigger />
components.
Property | Description |
---|---|
data-selected | Present on selected calendar cell triggers. |
data-disabled | Present on disabled calendar cell triggers. |
data-today | Present on today's calendar cell trigger. Only rendered on the client to avoid hydration mismatches |
data-range-start | Present on the start of a day range. (Only present in range mode) |
data-range-end | Present on the end of a day range. (Only present in range mode) |
data-in-range | Present on calendar cell trigger elements that are within a day range. (Including start and end, only present in range mode) |
data-corvu-calendar-celltrigger | Present on every calendar celltrigger element. |
Context which exposes various properties to interact with the calendar. Optionally provide a contextId to access a keyed context.
Returns
Property | Type/Description |
---|---|
mode | Accessor<'single'> | Accessor<'multiple'> | Accessor<'range'> The mode of the calendar. |
value | Accessor<Date | null> | Accessor<Date[]> | Accessor<{ from: Date | null, to: Date | null, }> The value of the calendar. |
setValue | Setter<Date | null> | Setter<Date[]> | Setter<{ from: Date | null, to: Date | null, }> Setter to change the value of the calendar. |
month | Accessor<Date> The month to display in the calendar. Is always the first month if multiple months are displayed. |
setMonth | Setter<Date> Setter to change the month to display in the calendar. Automatically adjusts the focusedDay to be within the visible range. |
focusedDay | Accessor<Date> The day that is currently focused in the calendar grid. |
setFocusedDay | Setter<Date> Setter to change the focused day in the calendar grid. Automatically adjusts the month to ensure the focused day is visible. |
startOfWeek | Accessor<number> The first day of the week. (0-6, 0 is Sunday) |
required | Accessor<boolean> Whether the value is required. Prevents unselecting the value. |
numberOfMonths | Accessor<number> The number of months to display in the calendar. |
disableOutsideDays | Accessor<boolean> Whether to disable outside days (Days falling in the previous or next month). |
fixedWeeks | Accessor<boolean> Whether to always display 6 weeks in a month. |
textDirection | Accessor<'ltr' | 'rtl'> The text direction of the calendar. |
weekdays | Accessor<Date[]> Array of weekdays starting from the first day of the week. |
months | Accessor<{ month: Date, weeks: Date[][], }[]> Array of the currently displayed months. |
weeks | Accessor<Date[][]> Function to get the weeks of the current month. Useful if only one month is being rendered. |
navigate | (action: `${'prev' | 'next'}-${'month' | 'year'}` | (date: Date) => Date) => void Function to navigate the calendar. |
min | Accessor<number | null> The minimum number of days that have to be selected. |
max | Accessor<number | null> The maximum number of days that can be selected. |
excludeDisabled | Accessor<boolean> Whether to reset the range selection if a disabled day is included in the range. |
labelIds | Accessor<Accessor<string | undefined>[]> The id attributes of the calendar label elements. Can be undefined if no Calendar.Label is present for the given month index. |
Props that are passed to the Root component children callback.
Props
Property | Type/Description |
---|---|
mode | 'single' | 'multiple' | 'range' The mode of the calendar. |
value | Date | null | Date[] | { from: Date | null, to: Date | null, } The value of the calendar. |
setValue | Setter<Date | null> | Setter<Date[]> | Setter<{ from: Date | null, to: Date | null, }> Setter to change the value of the calendar. |
month | Date The month to display in the calendar. Is always the first month if multiple months are displayed. |
setMonth | Setter<Date> Setter to change the month to display in the calendar. Automatically adjusts the focusedDay to be within the visible range. |
focusedDay | Date The day that is currently focused in the calendar grid. |
setFocusedDay | Setter<Date> Setter to change the focused day in the calendar grid. Automatically adjusts the month to ensure the focused day is visible. |
startOfWeek | number The first day of the week. (0-6, 0 is Sunday) |
required | boolean Whether the value is required. Prevents unselecting the value. |
numberOfMonths | number The number of months to display in the calendar. |
disableOutsideDays | boolean Whether to disable outside days (Days falling in the previous or next month). |
fixedWeeks | boolean Whether to always display 6 weeks in a month. |
textDirection | 'ltr' | 'rtl' The text direction of the calendar. |
weekdays | Date[] Array of weekdays starting from the first day of the week. |
months | { month: Date, weeks: Date[][], }[] Array of the currently displayed months. |
weeks | Date[][] Weeks of the current month. Useful if only one month is being rendered. |
navigate | (action: `${'prev' | 'next'}-${'month' | 'year'}` | (date: Date) => Date) => void Function to navigate the calendar. |
min | number | null The minimum number of days that have to be selected. |
max | number | null The maximum number of days that can be selected. |
excludeDisabled | boolean Whether to reset the range selection if a disabled day is included in the range. |
labelIds | [string | undefined] The id attributes of the calendar label elements. Can be undefined if no Calendar.Label is present for the given month index. |
Developed and designed by Jasmin