Skip to content

MultiInputDateRangeField API

API reference docs for the React MultiInputDateRangeField component. Learn about the props, CSS, and other APIs of this exported module.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

Import

import { MultiInputDateRangeField } from '@mui/x-date-pickers-pro/MultiInputDateRangeField';
// or
import { MultiInputDateRangeField } from '@mui/x-date-pickers-pro';
You can learn about the difference by reading this guide on minimizing bundle size.

Component name

The name MuiMultiInputDateRangeField can be used when providing default props or style overrides in the theme.

Props

NameTypeDefaultDescription
componentsobject{}
Overrideable components.
componentsPropsobject{}
The props used for each component slot.
defaultValueArray<any>
The default value. Use when the component is not controlled.
direction'column-reverse'
| 'column'
| 'row-reverse'
| 'row'
| Array<'column-reverse'
| 'column'
| 'row-reverse'
| 'row'>
| object
'column'
Defines the flex-direction style property. It is applied for all screen sizes.
disabledboolfalse
If true, the component is disabled.
disableFutureboolfalse
If true, disable values after the current date for date components, time for time components and both for date time components.
disablePastboolfalse
If true, disable values before the current date for date components, time for time components and both for date time components.
dividernode
Add an element between each child.
formatstring
Format of the date when rendered in the input(s).
maxDateany
Maximal selectable date.
minDateany
Minimal selectable date.
onChangefunc
Callback fired when the value changes.

Signature:
function(value: TValue, context: FieldChangeHandlerContext<TError>) => void
value: The new value.
context: The context containing the validation result of the current value.
onErrorfunc
Callback fired when the error associated to the current value changes.

Signature:
function(error: TError, value: TValue) => void
error: The new error.
value: The value associated to the error.
onSelectedSectionsChangefunc
Callback fired when the selected sections change.

Signature:
function(newValue: FieldSelectedSections) => void
newValue: The new selected sections.
readOnlyboolfalse
It prevents the user from changing the value of the field (not from interacting with the field).
selectedSections'all'
| 'day'
| 'hours'
| 'meridiem'
| 'minutes'
| 'month'
| 'seconds'
| 'weekDay'
| 'year'
| number
| { endIndex: number, startIndex: number }
The currently selected sections. This prop accept four formats: 1. If a number is provided, the section at this index will be selected. 2. If an object with a startIndex and endIndex properties are provided, the sections between those two indexes will be selected. 3. If a string of type MuiDateSectionName is provided, the first section with that name will be selected. 4. If null is provided, no section will be selected If not provided, the selected sections will be handled internally.
shouldDisableDatefunc
Disable specific date.

Signature:
function(day: TDate, position: string) => boolean
day: The date to test.
position: The date to test, 'start' or 'end'.
returns (boolean): Returns true if the date should be disabled.
slotPropsobject{}
The props used for each component slot.
slotsobject{}
Overrideable component slots.
spacingArray<number
| string>
| number
| object
| string
0
Defines the space between immediate children.
sxArray<func
| object
| bool>
| func
| object
The system prop, which allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.
valueArray<any>
The selected value. Used when the component is controlled.

Slots

NameTypeDefaultDescription
RootelementTypeMultiInputDateRangeFieldRoot
Element rendered at the root.
SeparatorelementTypeMultiInputDateRangeFieldSeparator
Element rendered between the two inputs.
TextFieldelementTypeTextField from '@mui/material'
Form control with an input to render a date. It is rendered twice: once for the start date and once for the end date. Receives the same props as @mui/material/TextField.
The component cannot hold a ref.