StaticDateRangePicker API
API reference docs for the React StaticDateRangePicker component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { StaticDateRangePicker } from '@mui/x-date-pickers-pro/StaticDateRangePicker';
// or
import { StaticDateRangePicker } from '@mui/x-date-pickers-pro';
Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
| Name | Type | Default | Description |
|---|---|---|---|
| autoFocus | bool | - |
If |
| calendars |
1 | 2 | 3 |
1 if `displayStaticWrapperAs === 'mobile'`, 2 otherwise. |
The number of calendars to render. |
| currentMonthCalendarPosition |
1 | 2 | 3 |
1 |
Position the current month is rendered in. |
| dayOfWeekFormatter | func | (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase() |
Formats the day of week displayed in the calendar header.
Signature:
function(date:
PickerValidDate) =>
string
|
| defaultRangePosition |
'end' | 'start' |
'start' |
The initial position in the edited date range. Used when the component is not controlled. |
| defaultValue | Array<object> | - |
The default value. Used when the component is not controlled. |
| disableAutoMonthSwitching | bool | false |
If |
| disabled | bool | false |
If |
| disableDragEditing | bool | false |
If |
| disableFuture | bool | false |
If |
| disableHighlightToday | bool | false |
If |
| disablePast | bool | false |
If |
| displayStaticWrapperAs |
'desktop' | 'mobile' |
"mobile" |
Force static wrapper inner components to be rendered in mobile or desktop mode. |
| displayWeekNumber | bool | - |
If |
| fixedWeekNumber | number | - |
The day view will show as many weeks as needed after the end of the current month to match this value. Put it to 6 to have a fixed number of weeks in Gregorian calendars |
| loading | bool | false |
If |
| localeText | object | - |
Locale for components texts.
Allows overriding texts
coming from
|
| maxDate | object | 2099-12-31 |
Maximal selectable date. |
| minDate | object | 1900-01-01 |
Minimal selectable date. |
| onAccept | func | - |
Callback fired when the value is accepted.
Signature:
function(value: TValue,
context:
FieldChangeHandlerContext<TError>)
=> void
|
| onChange | func | - |
Callback fired when the value changes.
Signature:
function(value: TValue,
context:
FieldChangeHandlerContext<TError>)
=> void
|
| onClose | func | - |
Callback fired when
component requests to be
closed. Can be fired when
selecting (by default on
|
| onError | func | - |
Callback fired when the
error associated with the
current value changes. When
a validation error is
detected, the
Signature:
function(error: TError,
value: TValue) =>
void
|
| onMonthChange | func | - |
Callback fired on month change.
Signature:
function(month:
PickerValidDate) =>
void
|
| onRangePositionChange | func | - |
Callback fired when the range position changes.
Signature:
function(rangePosition:
RangePosition) =>
void
|
| rangePosition |
'end' | 'start' |
- |
The position in the currently edited date range. Used when the component position is controlled. |
| readOnly | bool | false |
If |
| reduceAnimations | bool | `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13 |
If |
| referenceDate |
Array<object> | object |
The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`. |
The date used to generate
the new value when both
|
| renderLoading | func | () => "…" |
Component rendered on the
"day" view when
Signature:
function() =>
React.ReactNode
|
| shouldDisableDate | func | - |
Disable specific date.
Signature:
function(day:
PickerValidDate,
position: string) =>
boolean
|
| showDaysOutsideCurrentMonth | bool | false |
If |
| slotProps | object | {} |
The props used for each component slot. |
| slots | object | {} |
Overridable component slots. See Slots API below for more details. |
| sx |
Array<func | object | bool> | func | object |
- |
The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
| timezone | string | The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise. |
Choose which timezone to use for the value. Example: "default", "system", "UTC", "America/New_York". If you pass values from other timezones to some props, they will be converted to this timezone before being used. See the timezones documentation for more details. |
| value | Array<object> | - |
The selected value. Used when the component is controlled. |
| viewRenderers | { day?: func } | - |
Define custom view renderers
for each section. If
|
ref is forwarded to the root
element.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| actionBar |
PickersActionBar
|
Custom component for the action bar, it is placed below the Picker views. | |
| calendarHeader |
PickersCalendarHeader
|
Custom component for calendar header. Check the PickersCalendarHeader component. | |
| day |
DateRangePickerDay
|
Custom component for day in range pickers. Check the DateRangePickerDay component. | |
| layout | Custom component for wrapping the layout. It wraps the toolbar, views, action bar, and shortcuts. | ||
| leftArrowIcon |
ArrowLeft
|
Icon displayed in the left view switch button. | |
| nextIconButton |
IconButton
|
Button allowing to switch to the right view. | |
| previousIconButton |
IconButton
|
Button allowing to switch to the left view. | |
| rightArrowIcon |
ArrowRight
|
Icon displayed in the right view switch button. | |
| shortcuts |
PickersShortcuts
|
Custom component for the shortcuts. | |
| switchViewButton |
IconButton
|
Button displayed to switch between different calendar views. | |
| switchViewIcon |
ArrowDropDown
|
Icon displayed in the
SwitchViewButton. Rotated by
180° when the open view is
year.
|
|
| toolbar |
DateTimePickerToolbar
|
Custom component for the toolbar rendered above the views. |
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.