Fragiola

API: components

DateRangePickerInput

A DateRangePicker you can also type into, two ends of segments bound both ways to the picker's range, opt-in in an entry of its own.

A DateRangePicker whose range is also typed into segments: the user types the start and the end into two groups of segments, as in a DateRangeField, or opens the RangeCalendar with the Trigger, now the calendar button beside them. DateRangePickerInput.Root replaces the picker's Root; the picker's Trigger, Portal, Positioner and Popup and the bound RangeCalendar are used as they are (this entry exports DateRangePicker too). It is opt-in, in an entry of its own: a picker without it imports no segment editing, and /date-range-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).

Behaviour

  • Typing sets the value only when the entry is complete and valid (every segment set, inside min / max, not unavailable, the end not before the start). 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 interval start/end.

Anatomy

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

Usage

import { DateRangePicker, DateRangePickerInput } from "@fragiola/primitives-react/date-range-picker-input";

<Field.Root name="stay">
    <Field.Label>Stay</Field.Label>
    <DateRangePickerInput.Root value={value} onValueChange={setValue} min={today}>
        <DateRangePickerInput.Segments range="start" aria-label="Check-in" />
        <span aria-hidden="true">–</span>
        <DateRangePickerInput.Segments range="end" aria-label="Check-out" />
        <DateRangePicker.Trigger aria-label="Choose dates">📅</DateRangePicker.Trigger>
        <DateRangePicker.Portal>
            <DateRangePicker.Positioner>
                <DateRangePicker.Popup aria-label="Choose dates">
                    <RangeCalendar.Root>{/* … */}</RangeCalendar.Root>
                </DateRangePicker.Popup>
            </DateRangePicker.Positioner>
        </DateRangePicker.Portal>
    </DateRangePickerInput.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 DateRangePicker's.

Root

proptypedefaultdescription
valueDateRangeFieldValue | nullthe range, controlled; set only from a complete, valid entry
defaultValueDateRangeFieldValue | nullnullthe initial range, 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

proptypedefaultdescription
range"start" | "end"requiredthe end whose segments it holds

Name each end with aria-label; its children as DateRangeField's Input.

Segment

proptypedefaultdescription
segmentDateSegmentrequiredone of the Segments' segments

State and part attributes

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

Keyboard

On a segment, DateField's, across both ends; in the calendar, the DateRangePicker's.

Exports

entryexports
@fragiola/primitives-react/date-range-picker-inputChangeDetails, ChangeReason, DateFieldSegmentProps, DateFieldSegmentState, DateFieldState, DateFieldValue, DatePickerInputRootSharedProps, DateRange, DateRangeFieldInputProps, DateRangeFieldValue, DateRangePicker, DateRangePickerInput, DateRangePickerInputRootProps, DateSegment, PlainDate, PlainDateTime, RangeEnd, SegmentGranularity, SegmentType
@fragiola/primitives-vue/date-range-picker-inputChangeDetails, ChangeReason, DateFieldInputSlots, DateFieldSegmentProps, DateFieldSegmentState, DateFieldState, DateFieldValue, DatePickerInputRootSharedProps, DateRange, DateRangeFieldInputProps, DateRangeFieldValue, DateRangePicker, DateRangePickerInput, DateRangePickerInputRootEmits, DateRangePickerInputRootProps, DateSegment, PlainDate, PlainDateTime, RangeEnd, SegmentGranularity, SegmentType
@fragiola/primitives-angular/date-range-picker-input* (every export of the DateRangePicker entry), DateFieldSegment, DateFieldSegmentState, DateFieldState, DateFieldValue, DateRangeFieldInput, DateRangeFieldValue, DateRangePickerInputRoot, DateSegment, PlainDateTime, RangeEnd, SegmentGranularity, SegmentType