Date Range Picker API
View componentThe full prop reference for the Date Range Picker component. Pick a start and end date from a popover calendar.
Import
import { DateRangePicker } from '@structyl/styled';Props
DateRangePicker
Main date range picker component with integrated label, trigger, and popover content. Accepts all Root props plus styling variants.
| Prop | Type | Default |
|---|---|---|
| value# | DateRange | DateRangeTuple | null | undefinedThe selected date range (controlled) | — |
| defaultValue# | DateRange | DateRangeTuple | null | undefinedInitial date range (uncontrolled) | {} |
| onChange# | (range: DateRangeTuple, context: PickerChangeContext<DateRangeValidationError>) => voidFired when range changes with validation context | — |
| onValueChange# | (range: DateRange) => voidFired when range changes (alternative callback) | — |
| onAccept# | (range: DateRangeTuple, context: PickerChangeContext<DateRangeValidationError>) => voidFired when both start and end dates are selected | — |
| onError# | (error: DateRangeValidationError | null, value: DateRangeTuple) => voidFired when validation error changes | — |
| open# | booleanWhether the popover is open (controlled) | — |
| defaultOpen# | booleanInitial open state (uncontrolled) | false |
| onOpenChange# | (open: boolean) => voidFired when open state changes | — |
| onOpen# | () => voidFired when popover opens | — |
| onClose# | () => voidFired when popover closes | — |
| closeOnSelect# | booleanClose popover after both dates are selected | true |
| disabled# | booleanDisable the entire picker | — |
| readOnly# | booleanPrevent changes to the range | — |
| minDate# | DateMinimum selectable date | — |
| maxDate# | DateMaximum selectable date | — |
| disablePast# | booleanDisable all dates before today | — |
| disableFuture# | booleanDisable all dates after today | — |
| disabledDays# | (date: Date) => booleanFunction to determine if a date is disabled | — |
| shouldDisableDate# | (date: Date, position: DateRangePosition) => booleanFunction to disable dates by position ('start' | 'end') | — |
| weekStartsOn# | numberDay of week calendar starts (0=Sunday, 1=Monday, etc.) | — |
| locale# | stringBCP 47 locale for date formatting | — |
| autoFocus# | booleanAuto-focus the trigger on mount | — |
| calendars# | 1 | 2 | 3Number of calendars to display | 2 |
| currentMonthCalendarPosition# | 1 | 2 | 3Which calendar position shows the current month | — |
| dayOfWeekFormatter# | (date: Date) => stringCustom formatter for day-of-week headers | — |
| defaultRangePosition# | 'start' | 'end'Which part of the range to edit initially | 'start' |
| desktopModeMediaQuery# | stringCSS media query for desktop mode | — |
| disableAutoMonthSwitching# | booleanPrevent automatic month switching while selecting | — |
| disableDragEditing# | booleanDisable drag-to-select range | — |
| disableHighlightToday# | booleanDon't highlight today's date | — |
| disableOpenPicker# | booleanDisable opening the picker popover | — |
| displayWeekNumber# | booleanShow week numbers in calendar | — |
| fixedWeekNumber# | numberFixed number of weeks to display | — |
| format# | Intl.DateTimeFormatOptions | stringDate format for display (e.g., { dateStyle: 'short' } or 'yyyy-MM-dd') | { dateStyle: 'medium' } |
| formatDensity# | 'dense' | 'spacious'Spacing in formatted date output | 'dense' |
| inputRef# | React.Ref<HTMLInputElement>Ref to the underlying input element | — |
| keepOpenDuringFieldFocus# | booleanKeep popover open while field is focused | — |
| label# | React.ReactNodeLabel text displayed above the trigger | — |
| loading# | booleanShow loading state | — |
| localeText# | PickerLocaleTextLocale-specific text overrides | — |
| name# | stringName attribute for the trigger input | — |
| onMonthChange# | (month: Date) => voidFired when displayed month changes | — |
| onRangePositionChange# | (position: 'start' | 'end') => voidFired when range position changes | — |
| onSelectedSectionsChange# | (sections: PickerSelectedSections) => voidFired when selected date sections change | — |
| rangePosition# | 'start' | 'end'Which part of range is being edited (controlled) | — |
| referenceDate# | Date | DateRangeTupleReference date for picker logic | — |
| renderLoading# | () => React.ReactNodeCustom loading state renderer | — |
| selectedSections# | PickerSelectedSectionsWhich date sections are selected (controlled) | — |
| defaultSelectedSections# | PickerSelectedSectionsInitial selected sections (uncontrolled) | — |
| showDaysOutsideCurrentMonth# | booleanShow days from adjacent months | — |
| slotProps# | PickerSlotPropsProps passed to internal slot components | — |
| slots# | PickerSlotsCustom components for internal slots | — |
| sx# | PickerSxEmotion-style sx prop for styling | — |
| timezone# | stringIANA timezone for date operations | — |
| viewRenderers# | { day?: DateRangePickerViewRenderer | null }Custom renderer for day view | — |
| shortcuts# | DateRangePickerShortcut[] | falseQuick-select shortcuts (e.g., 'Last 7 days'); false hides shortcuts | — |
| className# | stringCSS class for the root wrapper | — |
| triggerClassName# | stringCSS class for the trigger button | — |
| contentClassName# | stringCSS class for the popover content | — |
| calendarClassName# | stringCSS class for the calendar grid | — |
| helperText# | React.ReactNodeHelper text displayed below the trigger | — |
| placeholder# | React.ReactNodePlaceholder when no date is selected | 'MM/DD/YYYY - MM/DD/YYYY' |
| separator# | stringSeparator between start and end dates | ' – ' |
| id# | stringHTML id for the trigger element | — |
| required# | booleanShow required indicator in label | — |
| error# | booleanDisplay error state styling | — |
| shortcutsClassName# | stringCSS class for the shortcuts container | — |
| showOutsideDays# | booleanShow days from adjacent months (alias for showDaysOutsideCurrentMonth) | — |
| rootProps# | React.ComponentPropsWithoutRef<'div'>Native HTML attributes (onClick, style, data-*, aria-*, etc.) on root wrapper | — |
DateRangePicker.Root
Low-level root container for date range picker state (primitives layer)
| Prop | Type | Default |
|---|---|---|
| value# | DateRange | DateRangeTuple | null | undefinedThe selected date range (controlled) | — |
| defaultValue# | DateRange | DateRangeTuple | null | undefinedInitial date range (uncontrolled) | {} |
| onChange# | (range: DateRangeTuple, context: PickerChangeContext<DateRangeValidationError>) => voidFired when range changes | — |
| onValueChange# | (range: DateRange) => voidFired when range changes (alternative) | — |
| onAccept# | (range: DateRangeTuple, context: PickerChangeContext<DateRangeValidationError>) => voidFired when complete range is selected | — |
| onError# | (error: DateRangeValidationError | null, value: DateRangeTuple) => voidFired when validation error changes | — |
| open# | booleanPopover open state (controlled) | — |
| defaultOpen# | booleanInitial popover state (uncontrolled) | false |
| onOpenChange# | (open: boolean) => voidFired when open state changes | — |
| onOpen# | () => voidFired when popover opens | — |
| onClose# | () => voidFired when popover closes | — |
| closeOnSelect# | booleanClose popover after both dates selected | true |
| disabled# | booleanDisable the picker | — |
| readOnly# | booleanPrevent changes | — |
| minDate# | DateMinimum selectable date | — |
| maxDate# | DateMaximum selectable date | — |
| disablePast# | booleanDisable dates before today | — |
| disableFuture# | booleanDisable dates after today | — |
| disabledDays# | (date: Date) => booleanCustom date disable function | — |
| shouldDisableDate# | (date: Date, position: 'start' | 'end') => booleanDisable by range position | — |
| weekStartsOn# | numberFirst day of week (0-6) | — |
| locale# | stringBCP 47 locale | — |
| autoFocus# | booleanAuto-focus on mount | — |
| calendars# | 1 | 2 | 3Number of calendars | — |
| currentMonthCalendarPosition# | 1 | 2 | 3Calendar position showing current month | — |
| dayOfWeekFormatter# | (date: Date) => stringCustom weekday formatter | — |
| defaultRangePosition# | 'start' | 'end'Initial range position | 'start' |
| desktopModeMediaQuery# | stringDesktop mode media query | — |
| disableAutoMonthSwitching# | booleanPrevent auto month switch | — |
| disableDragEditing# | booleanDisable drag-to-select | — |
| disableHighlightToday# | booleanDon't highlight today | — |
| disableOpenPicker# | booleanDisable opening picker | — |
| displayWeekNumber# | booleanShow week numbers | — |
| fixedWeekNumber# | numberFixed week count | — |
| format# | Intl.DateTimeFormatOptions | stringDate format options | — |
| formatDensity# | 'dense' | 'spacious'Format spacing | 'dense' |
| inputRef# | React.Ref<HTMLInputElement>Ref to input element | — |
| keepOpenDuringFieldFocus# | booleanKeep open during focus | — |
| label# | React.ReactNodeLabel text | — |
| loading# | booleanLoading state | — |
| localeText# | Record<string, React.ReactNode>Locale text overrides | — |
| name# | stringInput name attribute | — |
| onMonthChange# | (month: Date) => voidFired when displayed month changes | — |
| onRangePositionChange# | (position: 'start' | 'end') => voidFired when range position changes | — |
| onSelectedSectionsChange# | (sections: PickerSelectedSections) => voidFired when selected sections change | — |
| rangePosition# | 'start' | 'end'Current range position (controlled) | — |
| referenceDate# | Date | DateRangeTupleReference date | — |
| renderLoading# | () => React.ReactNodeCustom loading renderer | — |
| selectedSections# | PickerSelectedSectionsSelected sections (controlled) | — |
| defaultSelectedSections# | PickerSelectedSectionsInitial sections (uncontrolled) | — |
| showDaysOutsideCurrentMonth# | booleanShow adjacent month days | — |
| slotProps# | Record<string, unknown>Slot component props | — |
| slots# | Record<string, React.ElementType | null | undefined>Custom slot components | — |
| sx# | PickerSxEmotion sx prop | — |
| timezone# | stringIANA timezone | — |
| viewRenderers# | { day?: DateRangePickerViewRenderer | null }Custom view renderer | — |
| shortcuts# | DateRangePickerShortcut[] | falseShortcut buttons | — |
| children# | React.ReactNodeChild components | — |
DateRangePicker.Trigger
Button that opens the date range picker popover
| Prop | Type | Default |
|---|---|---|
| children# | React.ReactNodeTrigger content (icon, text, etc.) | — |
| className# | stringCSS class name | — |
| disabled# | booleanDisable the trigger | — |
| aria-invalid# | boolean | 'true' | 'false'Marks invalid state for assistive tech | — |
| aria-describedby# | stringHelper text element id | — |
| aria-label# | stringAccessible label | — |
DateRangePicker.Content
Popover content containing calendar and shortcuts
| Prop | Type | Default |
|---|---|---|
| children# | React.ReactNodeCustom content (overrides defaults) | — |
| className# | stringCSS class on content wrapper | — |
| align# | 'start' | 'center' | 'end'Popover alignment relative to trigger | 'center' |
| sideOffset# | numberDistance from trigger in pixels | 6 |
| calendars# | 1 | 2 | 3Number of calendars to display | — |
| calendarClassName# | stringCSS class on calendar wrapper | — |
| loading# | booleanShow loading state | — |
| shortcuts# | DateRangePickerShortcut[] | falseQuick-select shortcuts (false hides) | — |
| shortcutsClassName# | stringCSS class on shortcuts container | — |
| showOutsideDays# | booleanShow adjacent month days | — |
| showDaysOutsideCurrentMonth# | booleanShow adjacent month days (alias) | — |
DateRangePicker.Calendar
Styled calendar display with 1-3 month grids
| Prop | Type | Default |
|---|---|---|
| calendars# | 1 | 2 | 3Number of calendars to show | 2 |
| month# | DateDisplayed month (controlled) | — |
| defaultMonth# | DateInitial month (uncontrolled) | — |
| onMonthChange# | (month: Date) => voidFired when month changes | — |
| className# | stringCSS class on wrapper | — |
| showOutsideDays# | booleanShow adjacent month days | — |
| showDaysOutsideCurrentMonth# | booleanShow adjacent month days (alias) | — |
| locale# | stringBCP 47 locale | — |
DateRangePicker.CalendarMonth
Single month calendar grid
| Prop | Type | Default |
|---|---|---|
| month# | DateMonth to display | — |
| showOutsideDays# | booleanShow adjacent month days | — |
| showDaysOutsideCurrentMonth# | booleanShow adjacent month days (alias) | — |
| className# | stringCSS class name | — |
| locale# | stringBCP 47 locale | — |
DateRangePicker.Shortcuts
Container for quick-select shortcut buttons
| Prop | Type | Default |
|---|---|---|
| shortcuts# | DateRangePickerShortcut[]Array of shortcut definitions | — |
| className# | stringCSS class on container | — |
DateRangePicker.Value
Displays the formatted selected date range
| Prop | Type | Default |
|---|---|---|
| format# | Intl.DateTimeFormatOptions | stringDate format (e.g., { dateStyle: 'short' } or 'yyyy-MM-dd') | { dateStyle: 'medium' } |
| formatDensity# | 'dense' | 'spacious'Spacing in formatted output | 'dense' |
| locale# | stringBCP 47 locale for formatting | — |
| separator# | stringSeparator between dates | ' – ' |
| placeholder# | React.ReactNodeText when no date selected | 'Pick a date range' |
DateRangePicker.Loading
Displays loading state message
| Prop | Type | Default |
|---|
DateRangePicker.Portal
Portal container for popover content (re-exported from Popover primitive)
| Prop | Type | Default |
|---|---|---|
| children# | React.ReactNodeContent to portal | — |
DateRangePicker.Anchor
Anchor point for popover positioning (re-exported from Popover primitive)
| Prop | Type | Default |
|---|---|---|
| children# | React.ReactNodeAnchor content | — |
DateRangePickerShortcut
Type definition for quick-select shortcuts
| Prop | Type | Default |
|---|---|---|
| label# | React.ReactNodeDisplay text for the shortcut button | — |
| getValue# | (today: Date) => DateRange | DateRangeTuple | null | undefinedFunction returning the range when shortcut is selected | — |
| disabled# | booleanDisable this shortcut | — |
| closeOnSelect# | booleanClose popover after selecting this shortcut | — |
Source code
If you didn't find what you need here, read the component implementation .