Fragiola

API: components

MonthPicker

A trigger and a non-modal popup holding a bound MonthCalendar: one month, submitted as 2026-11.

A trigger and a non-modal popup holding a MonthCalendar: the DatePicker's trigger, popup, form and Field, with a month as its value. Its parts are the DatePicker's, named month-picker-*; the MonthCalendar inside the Popup has no value of its own and binds to the picker. The popup is a non-modal APG dialog disclosed by a button, as the DatePicker's. It renders no text: the trigger's content and the popup's name are yours.

Card expiry
Gallery

Behaviour

  • Open, choose, close: as the DatePicker's: the calendar focuses its focused month as the popup opens (the value, else the month holding today); choosing a month sets the value, closes the popup (reason item-press) and focuses the Trigger; Escape, an outside press and Tab out close it; focus is not trapped.
  • Forms: with a name, the Root renders a hidden input after its children, which submits expiry=2026-11, or an empty value. required, disabled, readOnly, a form reset and a Field work as the DatePicker's.

Anatomy

partelementdata-primitives-partrole
Rootnoneholds the value and the open state
Triggerbuttonmonth-picker-triggertoggles the popup, and anchors it
Portalnonemoves the Positioner to the end of body
Positionerdivmonth-picker-positionerplaces the popup next to the trigger
Popupdivmonth-picker-popupthe non-modal dialog, holding a MonthCalendar.Root
(hidden input)inputmonth-picker-inputwhat the form submits

Usage

import { MonthPicker, type PlainYearMonth } from "@fragiola/primitives-react/month-picker";
import { MonthCalendar } from "@fragiola/primitives-react/month-calendar";

<MonthPicker.Root value={value} onValueChange={setValue} name="month">
    <MonthPicker.Trigger>{/* the formatted value */}</MonthPicker.Trigger>
    <MonthPicker.Portal>
        <MonthPicker.Positioner>
            <MonthPicker.Popup aria-label="Choose month">
                <MonthCalendar.Root>{/* its header and grid */}</MonthCalendar.Root>
            </MonthPicker.Popup>
        </MonthPicker.Positioner>
    </MonthPicker.Portal>
</MonthPicker.Root>;

Props

Every part also takes what the primitive contract gives. Vue binds v-model:value and v-model:open; Angular [(value)], [(open)], (valueChangeDetails), (openChangeDetails). The other parts' props are the DatePicker's.

Root

proptypedefaultdescription
valuePlainYearMonth | nullthe chosen month, controlled
defaultValuePlainYearMonth | nullnullthe initial month, uncontrolled
onValueChange(value: PlainYearMonth | null, details: { reason }) => voidevery choice (reason item-press), a form reset (none)
openbooleanthe open state, controlled
defaultOpenbooleanfalsethe initial open state, uncontrolled
onOpenChange(open: boolean, details: OpenChangeDetails) => voidevery change, with its reason; called before the change, details.cancel() stops it
onOpenChangeComplete(open: boolean) => voidonce an opening or a closing has finished its transitions
actionsRef (react){ current: OverlayActions | null }receives close() and unmount(); Vue exposes them on the Root's template ref, Angular as the root directive's methods
minPlainYearMonth | nullpassed to the bound calendar
maxPlainYearMonth | nullpassed to the bound calendar
isUnavailable(month: PlainYearMonth) => booleanpassed to the bound calendar
localestringthe document's langpassed to the bound calendar
calendarCalendarSystemthe ISO calendara calendar system, passed to the bound calendar: the values are its months, submitted as the first day's ISO date with the system (2026-10-23[u-ca=persian])
columnsnumber3passed to the bound calendar
namestringthe hidden input's form name (a Field's wins)
requiredbooleanfalsea native form's validation blocks a submission with no value
disabledbooleanfalsethe Trigger cannot open the popup; nothing is submitted
readOnlybooleanfalsethe popup still opens; its calendar chooses nothing

Trigger

No props of its own.

Portal

proptypedefaultdescription
container (react, vue)Elementdocument.bodywhere the Positioner goes
keepMounted (react, vue)booleanfalsekeep the content rendered while closed (before the first opening and after an exit), hidden and data-closed; reopening shows the same elements
options (angular)Element | { container?, keepMounted? }{}the same two options: *datePickerPortal="{ keepMounted: true }", or *datePickerPortal="element" for a container alone

Positioner

proptypedefaultdescription
side"top" | "bottom" | "inline-start" | "inline-end" | "left" | "right""bottom"the side of the trigger
align"start" | "center" | "end""start"the alignment along that side
sideOffsetnumber0the distance from the trigger, in px
alignOffsetnumber0the shift along its edge, in px
collisionPaddingnumber8the space kept from the viewport's edges, in px
anchorElementthe triggerthe element to place the popup next to

No props of its own.

State and part attributes

The DatePicker's, named month-picker-*; the hidden input's value is the ISO text (expiry=2026-11).

Keyboard

The DatePicker's, with the MonthCalendar's keys in the popup.

Exports

entryexports
@fragiola/primitives-react/month-pickerAlign, ChangeDetails, ChangeReason, DatePicker, DatePickerPopupProps, DatePickerPopupState, DatePickerPortalProps, DatePickerPositionerProps, DatePickerPositionerState, DatePickerTriggerProps, DatePickerTriggerState, MonthPicker, MonthPickerRootProps, MonthPickerRootSharedProps, OpenChangeDetails, OverlayActions, OverlayPortalProps, OverlayRootProps, PlainYearMonth, PositionerProps, RenderProp, Side
@fragiola/primitives-vue/month-pickerAlign, ChangeDetails, ChangeReason, DatePicker, DatePickerPopupProps, DatePickerPopupState, DatePickerPortalProps, DatePickerPositionerState, DatePickerTriggerProps, DatePickerTriggerState, MonthPicker, MonthPickerRootEmits, MonthPickerRootProps, MonthPickerRootSharedProps, OpenChangeDetails, OverlayActions, OverlayPortalProps, OverlayRootEmits, OverlayRootProps, PlainYearMonth, PositionerProps, RenderSlotProps, Side
@fragiola/primitives-angular/month-pickerChangeDetails, ChangeReason, DatePickerPopup, DatePickerPopupState, DatePickerPortal, DatePickerPositioner, DatePickerPositionerState, DatePickerTrigger, DatePickerTriggerState, MonthPickerInputs, MonthPickerRoot, MonthPickerRootBase, MonthPickerState, OpenChangeDetails, OpenChangeEvent, OverlayActions, PlainYear, PlainYearMonth, ValueChangeEvent, YearMonthRange, YearRange, createMonthPicker