Dates
Date Range Picker Input
A date range picker typed into two ends' segments.
npx shadcn@latest add @fragiola/date-range-picker-inputA date range picker input types the range into two ends' segments in one row — one sequence
across both, as the Date Range Field's — with a trigger that
opens a bound Range Calendar. Each end is a Segments group with
range="start" or "end" and a name of its own; a choice in the calendar fills both ends.
Bases
Primitives-backed. Base UI has no typed date range picker, so this is one shared file (ui/date-range-picker-input.tsx) that wraps
Fragiola Primitives' DateRangePickerInput on both bases, and the item depends on
@fragiola/[email protected] on both. It follows the direction of the base's
DirectionProvider on Base UI too, and dir="rtl" without one.
On Base UI, the registry's Field is Base UI's, and a Fragiola Primitives picker does not join
it: name each end's Segments with aria-labelledby (the label's id and the end's own, so each end keeps its name, as the example does), and pass name, disabled and required
to the Root. On Fragiola Primitives the picker is also a Field control.
Inside a Base UI dialog. The popup is the Date Picker's, whose probe
(scenarios/overlays/date-picker-in-dialog) checks it inside the base's Dialog: the popup takes
the focus, Escape and a choice close only the popup and return the focus to the trigger, and the
next Escape closes the dialog.
Parts
| Part | Source |
|---|---|
Root | primitive DateRangePickerInput.Root |
Segments, Segment | the Date Field's Input (range) and Segment |
Separator | the Date Range Field's dash |
Trigger, Content | the Date Picker Input's, over DateRangePicker |