MultiInputDateRangeField API
API reference docs for the React MultiInputDateRangeField component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { MultiInputDateRangeField } from '@mui/x-date-pickers-pro/MultiInputDateRangeField';
// or
import { MultiInputDateRangeField } 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 | false | If |
| classes | Partial | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
| dateSeparator | string | "–" | String displayed between the start and the end dates. |
| defaultValue | PickerRangeValue | - | The default value. Use when the component is not controlled. |
| disabled | bool | false | If |
| disableFuture | bool | false | If |
| disablePast | bool | false | If |
| endFieldRef | {} | - | The ref object used to interact with the end field imperatively. |
| format | string | - | Format of the date when rendered in the input(s). |
| formatDensity | 'dense' | 'spacious' | "dense" | Density of the format when rendered in the input.
Setting |
| maxDate | {} | 2099-12-31 | Maximal selectable date. |
| minDate | {} | 1900-01-01 | Minimal selectable date. |
| onChange | func | - | Callback fired when the value changes. Signature: function(value: TValue, context: FieldChangeHandlerContext<TError>) => void
|
| 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
|
| onSelectedSectionsChange | func | - | Callback fired when the selected sections change. Signature: function(newValue: FieldSelectedSections) => void
|
| readOnly | bool | false | If |
| referenceDate | {} | The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used. | The date used to generate a part of the new value that is not present in the format when both |
| 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: PickerValidDate, position: string) => boolean
|
| shouldRespectLeadingZeros | bool | false | If |
| slotProps | MultiInputRangeFieldSlotProps | {} | The props used for each component slot. |
| slots | MultiInputRangeFieldSlots | {} | Overridable component slots. See Slots API below for more details. |
| startFieldRef | {} | - | The ref object used to interact with the start field imperatively. |
| 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 timezones documentation for more details. |
| value | PickerRangeValue | - | The selected value. Used when the component is controlled. |
ref is forwarded to the root element.Theme default props
You can use MuiMultiInputDateRangeField to change the default props of this component with the theme.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| root | .MuiMultiInputDateRangeField-root | MultiInputRangeFieldRoot | Element rendered at the root. |
| separator | .MuiMultiInputDateRangeField-separator | MultiInputRangeFieldSeparator | Element rendered between the two inputs. |
| textField | <PickersTextField /> | Form control with an input to render a date. It is rendered twice: once for the start date and once for the end date. |
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 |
|---|---|---|
| .MuiMultiInputDateRangeField-root | root | Styles applied to the root element. |
| .MuiMultiInputDateRangeField-separator | separator | Styles applied to the separator 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
styleOverridesproperty in a custom theme.
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.