Skip to content

DateRangePicker

Start/end date input with a paired calendar popover, quick-range presets, and locale-aware segments.

  • stable
  • since v0.1.0
  • 2.14 kB
  • forms
  • date

Start and end segments are independent spinbuttons; popover dialog wraps a labelled range calendar with full keyboard control.

Rendered as a segmented control — the calendar icon, the start/end date segments, and the chevron sit as raised tiles inside a tinted track, matching the other inputs. The focus ring lives on the track.

Preview
Open
tsx

outline (default), filled, and ghost tint the segmented track — the same vocabulary as the other form controls.

Preview
Open
tsx

sm, md (default), and lg.

Preview
Open
tsx

Disabled, read-only, invalid, and empty.

Preview
Open
tsx

Use minValue / maxValue to bound either end of the range.

Preview
Open
tsx

presets renders a left rail of DateRangePreset entries inside the popover. Clicking a preset commits the range and closes the popover.

Preview
Open
tsx

Show one or two months side-by-side in the popover with visibleMonths. The popover collapses to one month below ~640px regardless.

Preview
Open
tsx
PropTypeDefaultDescription
label
ReactNode
Visible label, also used as the picker's accessible name when a string.
size
"sm"|"md"|"lg"
Accepted for API parity with other form controls.
variant
"outline"|"filled"|"ghost"
"outline"
Visual treatment.
invalid
boolean
Renders the invalid state.
className
string
style
CSSProperties
presets
DateRangePreset[]
Quick-range presets rendered in the left rail. Rail is hidden when omitted.
visibleMonths
1|2
2
How many months to show side-by-side. Collapses to 1 below 640px regardless.
  • Start and end date segments are independent labelled spinbuttons — arrow keys nudge each segment, Tab moves between them.
  • The popover is a dialog with a labelled range calendar; arrow keys traverse days, Enter selects.
  • invalid toggles aria-invalid on the input group; range presets carry a data-active flag for visual styling without altering semantics.
  • Pass aria-label (or a string label) so the field is announced even when no value is set.
  • Pass presets={[{ label, value: { start, end } }]} for quick-range shortcuts like “Last 7 days”.
  • For narrow surfaces, set visibleMonths={1} so the calendar fits in tight popovers.
  • Wrap in LocaleProvider to flip segment order and first-day-of-week.
  • Compose with FormField + FormMessage to surface “pick a range” validation.