DateRangeCalendar API
API reference docs for the React DateRangeCalendar component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { DateRangeCalendar } from '@mui/x-date-pickers-pro/DateRangeCalendar';
// or
import { DateRangeCalendar } 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 |
availableRangePositions | Array<'end' | 'start'> | ['start', 'end'] | Range positions available for selection. This list is checked against when checking if a next range position can be selected. |
calendars | 1 | 2 | 3 | 2 | The number of calendars to render. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
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 selected 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 |
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 |
focusedView | 'day' | - | Controlled focused view. |
loading | bool | false | If |
maxDate | object | - | Maximal selectable date. |
minDate | object | - | Minimal selectable date. |
onChange | func | - | Callback fired when the value changes. Signature: function(value: TValue, selectionState: PickerSelectionState | undefined, selectedView: TView | undefined) => void
|
onFocusedViewChange | func | - | Callback fired on focused view change. Signature: function(view: TView, hasFocus: boolean) => void
|
onMonthChange | func | - | Callback fired on month change. Signature: function(month: TDate) => void
|
onRangePositionChange | func | - | Callback fired when the range position changes. Signature: function(rangePosition: RangePosition) => void
|
onViewChange | func | - | Callback fired on view change. Signature: function(view: TView) => void
|
openTo | 'day' | - | The default visible view. Used when the component view is not controlled. Must be a valid option from |
rangePosition | 'end' | 'start' | - | The position in the currently edited date range. Used when the component position is controlled. |
readOnly | bool | false | Make picker read only. |
reduceAnimations | bool | `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13 | If |
referenceDate | object | The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. | 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. |
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. |
view | 'day' | - | The visible view. Used when the component view is controlled. Must be a valid option from |
views | Array<'day'> | - | Available views. |
ref
is forwarded to the root element.Theme default props
You can use MuiDateRangeCalendar
to change the default props of this component with the theme.
Slot name | Class name | Default component | Description |
---|---|---|---|
calendarHeader | PickersCalendarHeader | Custom component for calendar header. Check the PickersCalendarHeader component. | |
day | DateRangePickersDay | Custom component for day in range pickers. Check the DateRangePickersDay component. | |
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. | |
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". |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiDateRangeCalendar-dayDragging | dayDragging | Styles applied to the day calendar container when dragging |
.MuiDateRangeCalendar-monthContainer | monthContainer | Styles applied to the container of a month. |
.MuiDateRangeCalendar-root | root | Styles applied to the root element. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.