DesktopDateRangePicker API
API reference docs for the React DesktopDateRangePicker component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { DesktopDateRangePicker } from '@mui/x-date-pickers-pro/DesktopDateRangePicker';
// or
import { DesktopDateRangePicker } from '@mui/x-date-pickers-pro';
Learn about the difference by reading this guide on minimizing bundle size.
Name | Type | Default | Description |
---|---|---|---|
autoFocus | bool | - | If |
calendars | 1 | 2 | 3 | 2 | The number of calendars to render on desktop. |
closeOnSelect | bool | `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop). | If |
currentMonthCalendarPosition | 1 | 2 | 3 | 1 | Position the current month is rendered in. |
dayOfWeekFormatter | func | (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase() | Formats the day of week displayed in the calendar header. Signature: function(date: TDate) => string
Returns: The name to display. |
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 |
disableOpenPicker | bool | false | If |
disablePast | bool | false | If |
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 |
format | string | - | Format of the date when rendered in the input(s). Defaults to localized format based on the used |
formatDensity | 'dense' | 'spacious' | "dense" | Density of the format when rendered in the input. Setting |
inputRef | ref | - | Pass a ref to the |
label | node | - | The label content. Ignored if the field has several inputs. |
loading | bool | false | If |
localeText | object | - | Locale for components texts. Allows overriding texts coming from |
maxDate | object | - | Maximal selectable date. |
minDate | object | - | Minimal selectable date. |
name | string | - | Name attribute used by the |
onAccept | func | - | Callback fired when the value is accepted. Signature: function(value: TValue) => void
|
onChange | func | - | Callback fired when the value changes. Signature: function(value: TValue, context: FieldChangeHandlerContext
|
onClose | func | - | Callback fired when the popup requests to be closed. Use in controlled mode (see |
onError | func | - | Callback fired when the error associated to the current value changes. If the error has a non-null value, then the Signature: function(error: TError, value: TValue) => void
|
onMonthChange | func | - | Callback fired on month change. Signature: function(month: TDate) => void
|
onOpen | func | - | Callback fired when the popup requests to be opened. Use in controlled mode (see |
onRangePositionChange | func | - | Callback fired when the range position changes. Signature: function(rangePosition: RangePosition) => void
|
onSelectedSectionsChange | func | - | Callback fired when the selected sections change. Signature: function(newValue: FieldSelectedSections) => void
|
open | bool | false | Control the popup or dialog open state. |
rangePosition | 'end' | 'start' | - | The position in the currently edited date range. Used when the component position is controlled. |
reduceAnimations | bool | `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13 | If |
referenceDate | 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 Returns: The node to render when loading. |
selectedSections | 'all' | 'day' | 'empty' | 'hours' | 'meridiem' | 'minutes' | 'month' | 'seconds' | 'weekDay' | 'year' | number | - | The currently selected sections. This prop accepts four formats: 1. If a number is provided, the section at this index will be selected. 2. If a string of type |
shouldDisableDate | func | - | Disable specific date. Signature: function(day: TDate, position: string) => boolean
Returns: Returns |
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 |
---|---|---|---|
toolbar | DateTimePickerToolbar | Custom component for the toolbar rendered above the views. | |
calendarHeader | PickersCalendarHeader | Custom component for calendar header. Check the PickersCalendarHeader component. | |
day | DateRangePickersDay | Custom component for day in range pickers. Check the DateRangePickersDay component. | |
previousIconButton | IconButton | Button allowing to switch to the left view. | |
nextIconButton | IconButton | Button allowing to switch to the right view. | |
leftArrowIcon | ArrowLeft | Icon displayed in the left view switch button. | |
rightArrowIcon | ArrowRight | Icon displayed in the right view switch button. | |
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". | |
actionBar | PickersActionBar | Custom component for the action bar, it is placed below the picker views. | |
shortcuts | PickersShortcuts | Custom component for the shortcuts. | |
layout | Custom component for wrapping the layout. It wraps the toolbar, views, action bar, and shortcuts. | ||
fieldRoot | Element rendered at the root. Ignored if the field has only one input. | ||
fieldSeparator | Element rendered between the two inputs. Ignored if the field has only one input. | ||
textField | TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`. | Form control with an input to render a date or time inside the default field. It is rendered twice: once for the start element and once for the end element. | |
clearIcon | ClearIcon | Icon to display inside the clear button. | |
clearButton | IconButton | Button to clear the value. | |
desktopPaper | PickersPopperPaper | Custom component for the paper rendered inside the desktop picker's Popper. | |
desktopTransition | Grow or Fade from '@mui/material' when `reduceAnimations` is `true`. | Custom component for the desktop popper Transition. | |
desktopTrapFocus | FocusTrap from '@mui/base'. | Custom component for trapping the focus inside the views on desktop. | |
popper | Popper from '@mui/material'. | Custom component for the popper inside which the views are rendered on desktop. | |
field |