Calendar
A calendar that lets users view and select dates.
Preview
Installation
npx sigma-ui@latest add calendarUsage
<script setup lang="ts">
import { type Ref, ref } from 'vue';
import { type DateValue, getLocalTimeZone, today } from '@internationalized/date';
import { Calendar } from '@/components/ui/calendar';
const value = ref(today(getLocalTimeZone())) as Ref<DateValue>;
</script>
<template>
<Calendar
v-model="value"
class="rounded-md border"
/>
</template>- Dates are @internationalized/date objects, which solve problems with internationalization. See Dates & Times in Reka for more details.
- Use
v-modelto control the selected date. Setmultipleto select several dates, thenv-modelis aDateValue[]. - Use
minValue,maxValue, andisDateDisabledto limit which dates can be selected.
Related
- Range Calendar
- Date Picker, including the month and year pickers built from
MonthPickerandYearPicker
Examples
Form
Month and year selects
Localization
The locale can be changed with the locale prop. You can also format the month selector using the useDateFormatter composable from Reka UI:
const formatter = useDateFormatter('en');
const locale = ref('fr');
formatter.setLocale(locale.value);<template>
<CalendarRoot :locale="locale">
...
</CalendarRoot>
</template>API Reference
Calendar
Props
| Prop | Type | Default |
|---|---|---|
defaultValueThe default value for the calendar | DateValue | - |
defaultPlaceholderThe default placeholder date | DateValue | - |
placeholderThe placeholder date, which is used to determine what month to display when no date is selected | DateValue | - |
pagedNavigationThis property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month | boolean | - |
preventDeselectWhether or not to prevent the user from deselecting a date without selecting another date first | boolean | - |
weekStartsOnThe day of the week to start the calendar on | WeekStartsOn | - |
weekdayFormatThe format to use for the weekday strings provided via the weekdays slot prop | WeekDayFormat | - |
calendarLabelThe accessible label for the calendar | string | - |
fixedWeeksWhether or not to always display 6 weeks in the calendar | boolean | - |
maxValueThe maximum date that can be selected | DateValue | - |
minValueThe minimum date that can be selected | DateValue | - |
localeThe locale to use for formatting dates | string | - |
numberOfMonthsThe number of months to display at once | number | - |
disabledWhether the calendar is disabled | boolean | - |
readonlyWhether the calendar is readonly | boolean | - |
initialFocusIf true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted | boolean | - |
isDateDisabledA function that returns whether or not a date is disabled | Matcher | - |
isDateUnavailableA function that returns whether or not a date is unavailable | Matcher | - |
dirThe reading direction of the calendar when applicable. <br> If omitted, inherits globally from | Direction | - |
nextPageA function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. | ((placeholder: DateValue) => DateValue) | - |
prevPageA function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. | ((placeholder: DateValue) => DateValue) | - |
modelValueThe controlled selected date value of the calendar. Can be bound as | DateValue | DateValue[] | null | - |
multipleWhether multiple dates can be selected | boolean | - |
disableDaysOutsideCurrentViewWhether or not to disable days outside the current view. | boolean | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Events
| Event | Payload |
|---|---|
update:modelValueEvent handler called whenever the model value changes | [date: DateValue] |
update:placeholderEvent handler called whenever the placeholder value changes | [date: DateValue] |
CalendarCell
Props
| Prop | Type | Default |
|---|---|---|
daterequiredThe date value for the cell | DateValue | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarCellTrigger
Props
| Prop | Type | Default |
|---|---|---|
dayrequiredThe date value provided to the cell trigger | DateValue | - |
monthrequiredThe month in which the cell is rendered | DateValue | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarGrid
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarGridBody
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarGridHead
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarGridRow
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarHeadCell
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarHeader
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarHeading
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | { headingValue: string; } |
CalendarNextButton
Props
| Prop | Type | Default |
|---|---|---|
nextPageThe function to be used for the next page. Overwrites the | ((placeholder: DateValue) => DateValue) | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
CalendarPrevButton
Props
| Prop | Type | Default |
|---|---|---|
prevPageThe function to be used for the prev page. Overwrites the | ((placeholder: DateValue) => DateValue) | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPicker
Props
| Prop | Type | Default |
|---|---|---|
defaultValueThe default value for the month picker | DateValue | - |
defaultPlaceholderThe default placeholder date | DateValue | - |
placeholderThe placeholder date, which is used to determine what year to display when no date is selected | DateValue | - |
preventDeselectWhether or not to prevent the user from deselecting a date without selecting another date first | boolean | - |
calendarLabelThe accessible label for the month picker | string | - |
maxValueThe maximum date that can be selected | DateValue | - |
minValueThe minimum date that can be selected | DateValue | - |
localeThe locale to use for formatting dates | string | - |
disabledWhether the month picker is disabled | boolean | - |
readonlyWhether the month picker is readonly | boolean | - |
initialFocusIf true, the month picker will focus the selected month, today, or the first month of the year on mount | boolean | - |
isMonthDisabledA function that returns whether or not a month is disabled | Matcher | - |
isMonthUnavailableA function that returns whether or not a month is unavailable | Matcher | - |
dirThe reading direction of the calendar when applicable. If omitted, inherits globally from | Direction | - |
nextPageA function that returns the next page of the month picker. Receives the current placeholder as an argument. | ((placeholder: DateValue) => DateValue) | - |
prevPageA function that returns the previous page of the month picker. Receives the current placeholder as an argument. | ((placeholder: DateValue) => DateValue) | - |
modelValueThe controlled selected month value of the month picker. Can be bound as | DateValue | DateValue[] | null | - |
multipleWhether multiple months can be selected | boolean | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Events
| Event | Payload |
|---|---|
update:modelValueEvent handler called whenever the model value changes | [date: DateValue | DateValue[]] |
update:placeholderEvent handler called whenever the placeholder value changes | [date: DateValue] |
MonthPickerCell
Props
| Prop | Type | Default |
|---|---|---|
daterequiredThe date value for the cell | DateValue | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerCellTrigger
Props
| Prop | Type | Default |
|---|---|---|
monthrequiredThe date value provided to the cell trigger | DateValue | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerGrid
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerGridBody
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerGridRow
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerHeader
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerHeading
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | { headingValue: string; } |
MonthPickerNextButton
Props
| Prop | Type | Default |
|---|---|---|
nextPageThe function to be used for the next page. Overwrites the | ((placeholder: DateValue) => DateValue) | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
MonthPickerPrevButton
Props
| Prop | Type | Default |
|---|---|---|
prevPageThe function to be used for the prev page. Overwrites the | ((placeholder: DateValue) => DateValue) | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPicker
Props
| Prop | Type | Default |
|---|---|---|
defaultValueThe default value for the year picker | DateValue | - |
defaultPlaceholderThe default placeholder date | DateValue | - |
placeholderThe placeholder date, which is used to determine what year range to display when no date is selected | DateValue | - |
preventDeselectWhether or not to prevent the user from deselecting a date without selecting another date first | boolean | - |
calendarLabelThe accessible label for the year picker | string | - |
maxValueThe maximum date that can be selected | DateValue | - |
minValueThe minimum date that can be selected | DateValue | - |
localeThe locale to use for formatting dates | string | - |
disabledWhether the year picker is disabled | boolean | - |
readonlyWhether the year picker is readonly | boolean | - |
initialFocusIf true, the year picker will focus the selected year, today, or the first year of the range on mount | boolean | - |
isYearDisabledA function that returns whether or not a year is disabled | Matcher | - |
isYearUnavailableA function that returns whether or not a year is unavailable | Matcher | - |
dirThe reading direction of the calendar when applicable. If omitted, inherits globally from | Direction | - |
nextPageA function that returns the next page of the year picker. Receives the current placeholder as an argument. | ((placeholder: DateValue) => DateValue) | - |
prevPageA function that returns the previous page of the year picker. Receives the current placeholder as an argument. | ((placeholder: DateValue) => DateValue) | - |
modelValueThe controlled selected year value of the year picker. Can be bound as | DateValue | DateValue[] | null | - |
multipleWhether multiple years can be selected | boolean | - |
yearsPerPageNumber of years to display per page | number | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Events
| Event | Payload |
|---|---|
update:modelValueEvent handler called whenever the model value changes | [date: DateValue | DateValue[]] |
update:placeholderEvent handler called whenever the placeholder value changes | [date: DateValue] |
YearPickerCell
Props
| Prop | Type | Default |
|---|---|---|
daterequiredThe date value for the cell | DateValue | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerCellTrigger
Props
| Prop | Type | Default |
|---|---|---|
yearrequiredThe date value provided to the cell trigger | DateValue | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerGrid
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerGridBody
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerGridRow
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerHeader
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerHeading
Props
| Prop | Type | Default |
|---|---|---|
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | { headingValue: string; } |
YearPickerNextButton
Props
| Prop | Type | Default |
|---|---|---|
nextPageThe function to be used for the next page. Overwrites the | ((placeholder: DateValue) => DateValue) | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
YearPickerPrevButton
Props
| Prop | Type | Default |
|---|---|---|
prevPageThe function to be used for the prev page. Overwrites the | ((placeholder: DateValue) => DateValue) | - |
asChildChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | boolean | - |
asThe element or component this component should render as. Can be overwritten by | AsTag | Component | "div" |
Slots
| Slot | Scope |
|---|---|
defaultThe content of the component. | - |
Accessibility
Adheres to the Date Picker Dialog WAI-ARIA design pattern for its date grid. Reka UI handles the grid roles, labels, and focus management.
| Key | Description |
|---|---|
| Tab | When focus moves onto the calendar, focuses the first navigation button. |
| Space | When focus is on the previous or next button, navigates the calendar. Otherwise, selects the date. |
| Enter | When focus is on the previous or next button, navigates the calendar. Otherwise, selects the date. |
| ArrowDown | When focus is on a date, moves focus to the same day of the next week, changing the month if necessary. |
| ArrowUp | When focus is on a date, moves focus to the same day of the previous week, changing the month if necessary. |
| ArrowRight | When focus is on a date, moves focus to the next day, changing the month if necessary. |
| ArrowLeft | When focus is on a date, moves focus to the previous day, changing the month if necessary. |