oakoss/ui
Components

Date Range Picker

Start and end dates with a range calendar in a popover, typed or picked.

SourceReact Aria
Stay
Type the dates, or pick them from the calendar.

Installation

npx shadcn@latest add @oakoss/date-range-picker

Usage

import { parseDate } from '@internationalized/date';

import { DateRangePicker } from '#/components/ui/inputs/date-range-picker';

<DateRangePicker
  defaultValue={{
    end: parseDate('2026-03-16'),
    start: parseDate('2026-03-14'),
  }}
  label="Stay"
/>;

Two Date Field inputs with a range Calendar in a popover. The value is { start, end }, each the same Internationalized Date object as Date Field's, and null until both are set. Both inputs scroll together when a long locale doesn't fit.

Examples

Date and time

A CalendarDateTime or ZonedDateTime range with a granularity of hour, minute or second adds start and end time fields under the calendar, named by startTimeLabel and endTimeLabel (default "Start time" and "End time"). They take the picker's hourCycle and hideTimeZone.

Booking

Two months

calendarProps reaches the calendar as on Date Picker. visibleMonths: 2 shows a longer range at once; the popover grows to fit, and the months stack where the screen is too narrow.

Trip

Accessibility

React Aria handles:

  • Group: both inputs, their decorations and the trigger form a group named by the label. Each input's segments are named "Start Date" or "End Date" (translated) with the label, and work as in Date Field. Typing past the start's last segment moves into the end.
  • Trigger and calendar: as on Date Picker. Picking the second day closes the popover and returns focus to the trigger.
  • Keyboard: Alt+↓ in a segment opens the calendar, and Escape closes it.

API

DateRangePicker

Extends React Aria's DateRangePicker.

Props

Prop

Type

Also accepts all React Aria DateRangePicker props, with granularity limited to day for a CalendarDate. A form gets each end's ISO value from hidden inputs named by startName and endName. Takes the layout props or children, not both: children replace the layout, built from the Field parts, DatePickerGroup, DateRangeInput and DatePickerContent.

Data attributes

AttributePresent when
data-slotAlways: date-range-picker
data-openThe calendar is open
data-focus-withinFocus is inside the picker
data-invalidThe picker is invalid
data-disabledThe picker is disabled

DateRangeInput

The start and end inputs and the dash between them, in one scrolling container, data-slot="date-range-input". Place it in a DatePickerGroup.

DateRangePickerTime

The start and end time fields the default layout adds to the popover, which render only while the picker's granularity includes a time.