Fragiola

API: components

MultipleCalendar

A month grid for choosing several dates, a press or Enter toggling each, with the Calendar's parts and keyboard, a limit, and one form entry per date.

A month grid for choosing several dates: an availability, a set of days off. It is the Calendar's grid and keyboard (the WAI-ARIA APG grid pattern, with multiple selection), with a Root of its own: a press on a date, or Enter and Space on the focused one, adds it or removes it.

It is its own component, in an entry of its own, not a multiple prop on Calendar.Root: the calendars' state is shared by the Calendar, RangeCalendar and picker entries, so a mode added there would make all of them bigger. Its parts are the Calendar's, named multiple-calendar-*.

Availability
Gallery

Behaviour

  • Toggle: a press on a date, or Enter / Space on the focused one, adds it when it is not chosen and removes it when it is (reason item-press). A disabled, unavailable or outside-month date, or a read-only calendar, changes nothing.
  • Value: a PlainDate[], sorted from the earliest, with no date twice.
  • Limit: maxSelected refuses a date that would make the value longer; the chosen dates can still be removed.
  • Focus: the grid is one tab stop. The focused date starts at the earliest chosen date, else today, kept inside min and max; after a toggle the focus stays on the cell. Every other key, the pages and the locale are the Calendar's.
  • Forms: with a name, the Root renders one <input type="hidden"> per chosen date, so the form submits days=2026-11-20&days=2026-11-24 (read it with FormData.getAll); disabled submits nothing; a form reset returns an uncontrolled calendar to its defaultValue. There is no required, no Field integration and no picker.

Anatomy

partelementdata-primitives-partrole
Rootdivmultiple-calendar-rootholds the dates
Heading, PrevButton, NextButton, Grid, GridHeader, HeaderCell, GridBody, Row, Cellas the Calendar'smultiple-calendar-<part>
(hidden inputs)input type="hidden"multiple-calendar-inputone per chosen date, after the Root's children, while it has a name

Usage

import { MultipleCalendar, type PlainDate } from "@fragiola/primitives-react/multiple-calendar";

const [days, setDays] = useState<PlainDate[]>([]);

<MultipleCalendar.Root value={days} onValueChange={setDays} maxSelected={5} name="days">
    <MultipleCalendar.PrevButton aria-label="Previous month">‹</MultipleCalendar.PrevButton>
    <MultipleCalendar.Heading />
    <MultipleCalendar.NextButton aria-label="Next month">›</MultipleCalendar.NextButton>
    <MultipleCalendar.Grid>
        <MultipleCalendar.GridHeader />
        <MultipleCalendar.GridBody />
    </MultipleCalendar.Grid>
</MultipleCalendar.Root>;

Props

Every part also takes what the primitive contract gives. The names below are React's; Vue binds them the same way (v-model:value, :max-selected), and Angular as inputs and outputs ([(value)], (valueChangeDetails), [maxSelected]). The other parts' props are the Calendar's.

Root

proptypedefaultdescription
valuePlainDate[]the chosen dates, sorted, controlled
defaultValuePlainDate[][]the initial dates, uncontrolled
onValueChange(value: PlainDate[], details: { reason }) => voidevery toggle (reason item-press), a form reset (none)
maxSelectednumberno limita date that would make the value longer is not added
namestringthe hidden inputs' form name: one per chosen date
minPlainDate | nulldates before it are disabled
maxPlainDate | nulldates after it are disabled
isDateUnavailable(date: PlainDate) => booleanunavailable dates can be focused, not chosen
localestringthe document's langa BCP 47 tag
calendarCalendarSystemthe ISO calendara calendar system: the grid's months and names; values stay ISO
firstDayOfWeeknumberthe locale's0–6, Sunday is 0
visibleMonthsnumber1how many months are shown
disabledbooleanfalsenothing can be focused or chosen; nothing is submitted
readOnlybooleanfalsedates can be focused, not toggled

Heading

proptypedefaultdescription
offsetnumber0which visible month it names

PrevButton

No props of its own.

NextButton

No props of its own.

Grid

proptypedefaultdescription
offsetnumber0which visible month it shows

GridHeader

No props of its own: React's children are a function of each weekday, Vue's default slot gets { weekday }, Angular's weekdays() lists them.

HeaderCell

proptypedefaultdescription
weekdayWeekday{ index, short, long }: its text is short, its abbr is long

GridBody

No props of its own: React's children are a function of each week, Vue's default slot gets { week }, Angular's weeks() lists them.

Row

proptypedefaultdescription
week (react, vue)PlainDate[]its seven dates; Angular loops over the week itself

Cell

proptypedefaultdescription
datePlainDateits date; its name is the full date from Intl unless it has an aria-label

State and part attributes

The Calendar's, named multiple-calendar-*, plus:

partattributes
Gridaria-multiselectable="true"
Cellaria-selected="true" and data-selected on every chosen date
hidden inputstype="hidden", name, value (ISO), disabled

Keyboard

The Calendar's; Enter and Space toggle the focused date.

Exports

entryexports
@fragiola/primitives-react/multiple-calendarCalendar, CalendarCellProps, CalendarCellState, CalendarGridBodyProps, CalendarGridHeaderProps, CalendarGridProps, CalendarHeaderCellProps, CalendarHeaderCellState, CalendarHeadingProps, CalendarHeadingState, CalendarNextButtonProps, CalendarOptions, CalendarPageButtonState, CalendarPrevButtonProps, CalendarRootSharedProps, CalendarRootState, CalendarRowProps, ChangeDetails, ChangeReason, DateRange, MultipleCalendar, MultipleCalendarRootProps, PlainDate, RenderProp, Weekday
@fragiola/primitives-vue/multiple-calendarCalendar, CalendarCellProps, CalendarCellState, CalendarGridBodySlots, CalendarGridHeaderSlots, CalendarGridProps, CalendarHeaderCellProps, CalendarHeaderCellState, CalendarHeadingProps, CalendarHeadingState, CalendarNextButtonProps, CalendarOptions, CalendarPageButtonState, CalendarPrevButtonProps, CalendarRootSharedProps, CalendarRootState, CalendarRowProps, CalendarRowSlots, ChangeDetails, ChangeReason, DateRange, MultipleCalendar, MultipleCalendarRootEmits, MultipleCalendarRootProps, PlainDate, RenderSlotProps, Weekday
@fragiola/primitives-angular/multiple-calendarCalendarCell, CalendarCellState, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, CalendarNextButton, CalendarNextButtonState, CalendarOptions, CalendarPrevButton, CalendarPrevButtonState, CalendarRow, ChangeDetails, ChangeReason, DateRange, MultipleCalendarDates, MultipleCalendarRoot, MultipleCalendarState, PlainDate, ValueChangeEvent, Weekday, injectCalendar