Skip to content
nexubDesign System
v12.7.0

Components · Form & Input

Date Range Picker

StableAdded v0.0.1 · updated v5.5.0

Dual-calendar date range selector.

import { DateRangePicker } from '@nexub/react';
View as Markdown

Playground

Props

size
TSX
<DateRangePicker placeholder="Select date range…" />

Examples

Default

Controlled

Presets and time zone

Quick ranges counted in the chosen time zone, which is labelled under the calendar.

Half-open stay

endExclusive and onComplete.

Pick check-in and check-out

States

  • default
  • disabled
  • readOnly
  • size="sm"
  • size="md"
  • size="lg"

Props

Props
PropTypeDefaultDescription
valueDateRange—Controlled date range value.
onChange((range: DateRange) => void)—Callback invoked when the selected range changes.
localeLocale—Month and weekday names, week start and the trigger format. Defaults to the NexubProvider dateLocale; the calendar also follows the provider dir, so arrows flip in RTL.
placeholderstring—Placeholder text shown in the trigger input when no range is selected.
disabledbooleanfalseDisables the trigger input and calendar popover.
minDateDate—Earliest selectable date. Dates before this are greyed out.
maxDateDate—Latest selectable date. Dates after this are greyed out.
aria-labelstring—Field name for screen readers; the selected value is appended.
idstring—Id for the trigger button, e.g. to pair with a <label htmlFor>.
presetsboolean | DateRangePreset[]—true adds Today, Last 7 days, Last 30 days, Month to date and Last month beside the calendar; or pass your own (5.5).
timeZonestring—IANA zone the dates mean, e.g. Europe/London. Shown under the calendar; presets count "today" there (5.5). todayIn(zone) is exported.
endExclusivebooleanfalse11.2: to is the day after the last day (half-open), in and out; the calendar still shows the last day.
onComplete((range: { from: Date; to: Date; }) => void)—11.2: called once both ends are set (the second day picked, or a preset).
classNamestring—
readOnlybooleanfalseShows the range but the calendar can't open; stays focusable.
sheetfalse | true | 'auto''auto' (pass `sheet={false}` to keep a popover on small screens)true: bottom sheet. 'auto': bottom sheet below the md breakpoint, a popover above.
size'sm' | 'md' | 'lg''md'

Design tokens

Date Range Picker reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Date Range Picker below it, and leave the roles other components share alone. See the three token tiers.

Input, Textarea, Select and Combobox triggers.

Date Range Picker design tokens
TokenAliasesNotes
--field-bg--color-surface-container-lowest—
--field-fg--color-on-surface—
--field-border--color-outline—
--field-radius--shape-field—
CSS
/* One area of your app */
.checkout {
  --field-bg: var(--color-secondary);
}

On iOS & Android