Fragiola

API: components

DatePickerInput

A DatePicker you can also type into, its DateField segments bound both ways to the picker's value, opt-in in an entry of its own.

A DatePicker whose date is also typed into segments: the user types the date into DateField segments, or opens the Calendar with the Trigger, now the calendar button beside them. DatePickerInput.Root replaces the picker's Root; the picker's Trigger, Portal, Positioner and Popup and the bound Calendar are used as they are (this entry exports DatePicker too). It is opt-in, in an entry of its own: a picker without it imports no segment editing, and /date-picker is unchanged.

The APG has no date field: each segment is the APG spinbutton, as in a DateField, and the binding follows React Aria's DatePicker as the behaviour reference (the behaviour rule).

Departure date
Gallery

Behaviour

  • Typing sets the value only when the entry is complete and valid (every segment set, inside min / max, not unavailable). An incomplete or invalid entry makes the value null, and its segments stay as typed (data-invalid while complete and invalid): the form never submits a date the calendar could not have chosen.
  • The calendar opens on the typed value and fills the segments when a date is chosen (reason item-press). With a time granularity, the calendar chooses the date part: the typed time is kept, a time still empty takes placeholderValue's (midnight).
  • The calendar never clears typed segments: opening and closing it, or an entry going back to null, leaves them as they are. One edit reports one onValueChange at most: no loop.
  • Field and form: inside a Field the label names the segments and a press on it focuses the first one; the Trigger is named by the label and itself ("Departure Choose date"). The form is the picker's: one hidden input with the ISO date.
  • Calendar systems and time zones: calendar goes to the bound calendar and the segments (the value stays ISO); timeZone, hideTimeZone and disambiguation are a DateField's. A chosen date takes the typed time and resolves it in the zone (reject resolves compatible there: a press must choose something); the form submits the zoned ISO text.

Anatomy

partelementdata-primitives-partrole
Rootnonethe picker's state and the segments'
Segmentsdivdate-picker-segmentsgroup of the segments
Segmentspandate-picker-segmentspinbutton, or a literal hidden from assistive technology
Trigger, Portal, Positioner, Popupdate-picker-*the DatePicker's
(hidden input)inputdate-picker-inputthe picker's form value

Usage

import { DatePicker, DatePickerInput } from "@fragiola/primitives-react/date-picker-input";

<Field.Root name="departure">
    <Field.Label>Departure</Field.Label>
    <DatePickerInput.Root value={value} onValueChange={setValue} min={today}>
        <DatePickerInput.Segments>
            {(segment) => <DatePickerInput.Segment key={segment.index} segment={segment} />}
        </DatePickerInput.Segments>
        <DatePicker.Trigger aria-label="Choose date">📅</DatePicker.Trigger>
        <DatePicker.Portal>
            <DatePicker.Positioner>
                <DatePicker.Popup aria-label="Choose date">
                    <Calendar.Root>{/* … */}</Calendar.Root>
                </DatePicker.Popup>
            </DatePicker.Positioner>
        </DatePicker.Portal>
    </DatePickerInput.Root>
</Field.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
valuePlainDate | PlainDateTime | nullthe date, controlled; set only from a complete, valid entry
defaultValuePlainDate | PlainDateTime | nullnullthe initial date, uncontrolled
onValueChange(value, details: { reason, event }) => voidevery change: input-change, input-clear, keyboard (typed), item-press (chosen), none (a reset)
openbooleanthe open state, controlled
defaultOpenbooleanfalsethe initial open state, uncontrolled
onOpenChange(open: boolean, details: OpenChangeDetails) => voidevery change, with its reason (trigger-press, item-press, escape-key, outside-press, focus-out); called before the change, details.cancel() stops it
onOpenChangeComplete(open: boolean) => voidonce an opening or a closing has finished its transitions (not on the first render, nor for an exit a reopening interrupted)
actionsRef (react){ current: OverlayActions | null }receives close() (reason imperative-action) and unmount() (ends an exit now); Vue exposes them on the Root's template ref, Angular as the root directive's methods
minPlainDate | nullthe calendar's and the segments'
maxPlainDate | nullthe calendar's and the segments'
isDateUnavailable(date: PlainDate) => booleanthe calendar's and the segments'
localestringthe document's langthe calendar's and the segments'
calendarCalendarSystemthe ISO calendara calendar system: the bound calendar and the segments show and edit its year, month (up to 13) and day, and an era where it has several; values stay ISO
timeZoneTimeZonea time zone (timeZone("America/New_York") from @fragiola/primitives/time-zone): the values are ZonedDateTimes in it, a time granularity shows its name, and the form submits 2026-11-01T01:30-05:00[America/New_York]
hideTimeZonebooleanfalseleaves the zone's name segment out
disambiguation"compatible" | "earlier" | "later" | "reject""compatible"how a wall time the zone skips or repeats (a DST change) resolves, Temporal's; reject makes no value
firstDayOfWeeknumberthe locale'spassed to the bound calendar
visibleMonthsnumber1passed to the bound calendar
namestringthe hidden input's form name (a Field's wins); without one, no input is rendered
requiredbooleanfalsea native form's validation blocks a submission with no date
disabledbooleanfalsethe Trigger cannot open the popup; the hidden input submits nothing
readOnlybooleanfalsethe popup still opens; its calendar can be browsed, no date chosen
granularity"day" | "hour" | "minute" | "second""day"a time granularity adds the time's segments; the calendar chooses the date
placeholderValuePlainDate | PlainDateTimetoday at midnightwhat an arrow on an empty segment starts from, and a chosen date's time while the time is empty
hourCycle12 | 24the locale'sa time granularity's clock

Segments

No props of its own. Its children: a function of each segment (Vue: the default slot's { segment }; Angular: @for over segments()).

Segment

proptypedefaultdescription
segmentDateSegmentrequiredone of the Segments' segments

State and part attributes

The segments as DateField's, named date-picker-*; the Trigger, the Popup and the hidden input as the DatePicker's.

Keyboard

On a segment, DateField's; in the calendar, the DatePicker's.

Exports

entryexports
@fragiola/primitives-react/date-picker-inputChangeDetails, ChangeReason, DateFieldInputProps, DateFieldSegmentProps, DateFieldSegmentState, DateFieldState, DateFieldValue, DatePicker, DatePickerInput, DatePickerInputRootProps, DatePickerInputRootSharedProps, DateSegment, PlainDate, PlainDateTime, SegmentGranularity, SegmentType
@fragiola/primitives-vue/date-picker-inputChangeDetails, ChangeReason, DateFieldInputSlots, DateFieldSegmentProps, DateFieldSegmentState, DateFieldState, DateFieldValue, DatePicker, DatePickerInput, DatePickerInputRootEmits, DatePickerInputRootProps, DatePickerInputRootSharedProps, DateSegment, PlainDate, PlainDateTime, SegmentGranularity, SegmentType
@fragiola/primitives-angular/date-picker-input* (every export of the DatePicker entry), DateFieldInput, DateFieldSegment, DateFieldSegmentState, DateFieldState, DateFieldValue, DatePickerInputInputs, DatePickerInputRoot, DatePickerInputState, DateSegment, hourCycleAttribute, PickerValue, PlainDateTime, SegmentGranularity, SegmentType