structyl

Date Range Picker

stable

Pick a start and end date from a popover calendar.

Basic usage

Examples

Controlled range

Track the selected date range externally for form submission.

MUI-style range field

Use tuple values for MUI parity or the Structyl range object for compound usage.

Range closes after both start and end dates are selected.

Preset shortcuts

Use built-in shortcut buttons or provide your own shortcut ranges.

Shortcut selections call onChange and onAccept with source='shortcut'.

Date range field

Use DateRangePicker for reporting windows, bookings and project timelines.

Features

  • MUI-style tuple values.
  • Range selection.
  • Popover-anchored.

Installation

bash
pnpm dlx structyl add date-range-picker

API Reference

DateRangePicker

MUI-style range field with tuple values and calendar popover.

PropTypeDefault
value / defaultValue[Date | null, Date | null] | { from?: Date; to?: Date }

Controlled or uncontrolled range.

onChange / onAccept(range, context) => void

MUI-style callbacks with validation context.

shortcutsDateRangePickerShortcut[] | false

Preset action buttons. Defaults include Today, Yesterday, Last 7 days, Last 30 days, This month and Last month.

calendars / currentMonthCalendarPosition1 | 2 | 3

Visible month count and current month placement compatibility.

rangePosition / defaultRangePosition / onRangePositionChange'start' | 'end'

Controlled edited edge of the range.

minDate / maxDate / disablePast / disableFutureDate / boolean

Date validation bounds.

shouldDisableDate(date: Date, position: 'start' | 'end') => boolean

Custom disabled-date predicate with range edge.

disableAutoMonthSwitching / disableDragEditingboolean

MUI range behavior compatibility props.

format / formatDensity / selectedSectionsMUI field props

Formatting and field section props.

loading / renderLoadingboolean / () => ReactNode

Render loading state.

displayWeekNumber / fixedWeekNumber / showDaysOutsideCurrentMonthcalendar props

Calendar rendering options.

slots / slotProps / sx / viewRenderers / timezoneobject / string

MUI customization and timezone compatibility props.

DateRangePicker.Root

Compound date-range input — Calendar in a Popover.

PropTypeDefault
value{ from?: Date; to?: Date } | [Date | null, Date | null]

Controlled range.

onValueChange(range) => void

Structyl-style change callback.

DateRangePicker.Trigger

Opens the calendar.

PropTypeDefault

DateRangePicker.Content

The popover with the range calendar.

PropTypeDefault
calendars1 | 2

Number of visible months.

DateRangePicker.Calendar

Styled range calendar bound to DateRangePicker state.

PropTypeDefault
Date Range Picker | structyl