◇
Calendar
12 partsAnatomy
Import the parts and compose them. Each part forwards attributes to its underlying element.
vue
import {
CalendarRoot,
CalendarHeader,
CalendarHeading,
CalendarPrev,
CalendarNext,
CalendarGrid,
CalendarGridHead,
CalendarGridBody,
CalendarGridRow,
CalendarHeadCell,
CalendarCell,
CalendarCellTrigger,
} from '@robonen/primitives/calendar';
<CalendarRoot>
<CalendarHeader />
<CalendarHeading />
<CalendarPrev />
<CalendarNext />
<CalendarGrid />
<CalendarGridHead />
<CalendarGridBody />
<CalendarGridRow />
<CalendarHeadCell />
<CalendarCell />
<CalendarCellTrigger />
</CalendarRoot>API Reference
CalendarRoot
Root| Prop | Type | Description |
|---|---|---|
defaultValue? | Date | Uncontrolled default selected date. |
defaultPlaceholder? | Date | Uncontrolled default placeholder (displayed month). |
minValue? | Date | Minimum selectable date. |
maxValue? | Date | Maximum selectable date. |
isDateUnavailable? | (date: Date) => boolean | Predicate marking a date as unavailable (not selectable). |
isDateDisabled? | (date: Date) => boolean | Predicate marking a date as disabled. |
pagedNavigation? | boolean | Prev/Next navigate by `numberOfMonths` instead of one month. |
weekStartsOn? | 0 | 1 | 2 | 3 | 4 | 5 | 6 | First day of week (0=Sun ... 6=Sat). |
weekdayFormat? | WeekDayFormat | Width of localized weekday names. |
fixedWeeks? | boolean | Always render 6 weeks per month. |
numberOfMonths? | number | Number of months displayed simultaneously. |
disabled? | boolean | Disable the whole calendar. |
readonly? | boolean | Make the calendar read-only. |
initialFocus? | boolean | Auto-focus the calendar on mount. |
locale? | string | Locale for `Intl` formatting. |
dir? | 'ltr' | 'rtl' | Reading direction. |
nextPage? | (placeholder: Date) => Date | Override "next page" navigation logic. |
prevPage? | (placeholder: Date) => Date | Override "prev page" navigation logic. |
calendarLabel? | string | Calendar accessible label prefix. |
CalendarHeader
HeaderNo props or events — renders its element and forwards attributes.
CalendarHeading
HeadingNo props or events — renders its element and forwards attributes.
CalendarPrev
Prev| Prop | Type | Description |
|---|---|---|
prevPage? | (placeholder: Date) => Date | Override the root's `prevPage` for just this button. |
CalendarNext
Next| Prop | Type | Description |
|---|---|---|
nextPage? | (placeholder: Date) => Date | Override the root's `nextPage` for just this button. |
CalendarGrid
Grid| Prop | Type | Description |
|---|---|---|
month? | Date | The month this grid represents. Defaults to the root placeholder's month. |
CalendarGridHead
GridHeadNo props or events — renders its element and forwards attributes.
CalendarGridBody
GridBodyNo props or events — renders its element and forwards attributes.
CalendarGridRow
GridRowNo props or events — renders its element and forwards attributes.
CalendarHeadCell
HeadCell| Prop | Type | Description |
|---|---|---|
day? | Date | The day this header cell represents — used for `aria-label`. |
CalendarCell
Cell| Prop | Type | Description |
|---|---|---|
date | Date | The date this cell represents. |
CalendarCellTrigger
CellTrigger| Prop | Type | Description |
|---|---|---|
day | Date | The day this trigger represents. |
month? | Date | The month this trigger's cell belongs to. Defaults to grid context. |