Components · Form & Input
Date Range Picker
StableAdded v0.0.1 · updated v5.5.0
Dual-calendar date range selector.
import { DateRangePicker } from '@nexub/react';Playground
Props
size
<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.
States
defaultdisabledreadOnlysize="sm"size="md"size="lg"
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | DateRange | — | Controlled date range value. |
| onChange | ((range: DateRange) => void) | — | Callback invoked when the selected range changes. |
| locale | Locale | — | 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. |
| placeholder | string | — | Placeholder text shown in the trigger input when no range is selected. |
| disabled | boolean | false | Disables the trigger input and calendar popover. |
| minDate | Date | — | Earliest selectable date. Dates before this are greyed out. |
| maxDate | Date | — | Latest selectable date. Dates after this are greyed out. |
| aria-label | string | — | Field name for screen readers; the selected value is appended. |
| id | string | — | Id for the trigger button, e.g. to pair with a <label htmlFor>. |
| presets | boolean | 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). |
| timeZone | string | — | IANA zone the dates mean, e.g. Europe/London. Shown under the calendar; presets count "today" there (5.5). todayIn(zone) is exported. |
| endExclusive | boolean | false | 11.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). |
| className | string | — | |
| readOnly | boolean | false | Shows the range but the calendar can't open; stays focusable. |
| sheet | false | 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.
| Token | Aliases | Notes |
|---|---|---|
| --field-bg | --color-surface-container-lowest | — |
| --field-fg | --color-on-surface | — |
| --field-border | --color-outline | — |
| --field-radius | --shape-field | — |
/* One area of your app */
.checkout {
--field-bg: var(--color-secondary);
}On iOS & Android
Web only
Date Range Picker has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.