interface DateRangePickerProps {
    autoFocus?: boolean;
    calendars?: 1 | 2 | 3;
    className?: string;
    closeOnSelect?: boolean;
    components?: DateRangePickerSlotsComponents<Date>;
    componentsProps?: DateRangePickerSlotsComponentsProps<Date>;
    currentMonthCalendarPosition?: 1 | 2 | 3;
    customTranslation?: DeepPartial<Translation>;
    dayOfWeekFormatter?: ((day: string, date: Date) => string);
    defaultCalendarMonth?: Date;
    defaultRangePosition?: RangePosition;
    defaultValue?: DateRange<Date>;
    desktopModeMediaQuery?: string;
    disableAutoMonthSwitching?: boolean;
    disabled?: boolean;
    disableDragEditing?: boolean;
    disableFuture?: boolean;
    disableHighlightToday?: boolean;
    disableOpenPicker?: boolean;
    disablePast?: boolean;
    displayWeekNumber?: boolean;
    fixedWeekNumber?: number;
    format?: string;
    formatDensity?: "dense" | "spacious";
    inputRef?: Ref<HTMLInputElement>;
    label?: ReactNode;
    lang: "sv" | "en";
    loading?: boolean;
    localeText?: PickersInputComponentLocaleText<Date>;
    maxDate?: Date;
    minDate?: Date;
    name?: string;
    onAccept?: ((value: DateRange<Date>) => void);
    onChange?: ((value: DateRange<Date>, context: PickerChangeHandlerContext<DateRangeValidationError>) => void);
    onClose?: (() => void);
    onError?: ((error: DateRangeValidationError, value: DateRange<Date>) => void);
    onMonthChange?: ((month: Date) => void);
    onOpen?: (() => void);
    onRangePositionChange?: ((rangePosition: RangePosition) => void);
    onSelectedSectionsChange?: ((newValue: FieldSelectedSections) => void);
    open?: boolean;
    rangePosition?: RangePosition;
    readOnly?: boolean;
    reduceAnimations?: boolean;
    referenceDate?: Date;
    renderLoading?: (() => ReactNode);
    selectedSections?: FieldSelectedSections;
    shouldDisableDate?: ((day: Date, position: "start" | "end") => boolean);
    showDaysOutsideCurrentMonth?: boolean;
    slotProps?: DateRangePickerSlotsComponentsProps<Date>;
    slots?: UncapitalizeObjectKeys<DateRangePickerSlotsComponents<Date>>;
    sx?: SxProps<Theme>;
    timezone?: string;
    value?: DateRange<Date>;
    viewRenderers?: Partial<PickerViewRendererLookup<DateRange<Date>, "day", DateRangeViewRendererProps<Date, "day">, {}>>;
}

Hierarchy

  • DateRangePickerProps<Date>
    • DateRangePickerProps

Properties

autoFocus?: boolean

If true, the main element is focused during the first mount. This main element is:

  • the element chosen by the visible view if any (i.e: the selected day on the day view).
  • the input element if there is a field rendered.
calendars?: 1 | 2 | 3

The number of calendars to render on desktop.

2
className?: string

Class name applied to the root element.

closeOnSelect?: boolean

If true, the popover or modal will close after submitting the full date.

true for desktop, false for mobile (based on the chosen wrapper and desktopModeMediaQuery prop).

components?: DateRangePickerSlotsComponents<Date>

Overridable components.

{}

Please use slots.

componentsProps?: DateRangePickerSlotsComponentsProps<Date>

The props used for each component slot.

{}

Please use slotProps.

currentMonthCalendarPosition?: 1 | 2 | 3

Position the current month is rendered in.

1
customTranslation?: DeepPartial<Translation>

Translation object used for screen reader texts.

dayOfWeekFormatter?: ((day: string, date: Date) => string)

Formats the day of week displayed in the calendar header.

Type declaration

    • (day, date): string
    • Parameters

      • day: string

        The day of week provided by the adapter. Deprecated, will be removed in v7: Use date instead.

      • date: Date

        The date of the day of week provided by the adapter.

      Returns string

      The name to display.

(_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
defaultCalendarMonth?: Date

Default calendar month displayed when value={[null, null]}.

Consider using referenceDate instead.

defaultRangePosition?: RangePosition

The initial position in the edited date range. Used when the component is not controlled.

'start'
defaultValue?: DateRange<Date>

The default value. Used when the component is not controlled.

desktopModeMediaQuery?: string

CSS media query when Mobile mode will be changed to Desktop.

'@media (pointer: fine)'
'@media (min-width: 720px)' or theme.breakpoints.up("sm")
disableAutoMonthSwitching?: boolean

If true, after selecting start date calendar will not automatically switch to the month of end date.

false
disabled?: boolean

If true, the picker and text field are disabled.

false
disableDragEditing?: boolean

If true, editing dates by dragging is disabled.

false
disableFuture?: boolean

If true, disable values after the current date for date components, time for time components and both for date time components.

false
disableHighlightToday?: boolean

If true, today's date is rendering without highlighting with circle.

false
disableOpenPicker?: boolean

If true, the open picker button will not be rendered (renders only the field).

false
disablePast?: boolean

If true, disable values before the current date for date components, time for time components and both for date time components.

false
displayWeekNumber?: boolean

If true, the week number will be display in the calendar.

fixedWeekNumber?: number

Calendar will show more weeks in order to match this value. Put it to 6 for having fix number of week in Gregorian calendars

undefined
format?: string

Format of the date when rendered in the input(s). Defaults to localized format based on the used views.

formatDensity?: "dense" | "spacious"

Density of the format when rendered in the input. Setting formatDensity to "spacious" will add a space before and after each /, - and . character.

"dense"
inputRef?: Ref<HTMLInputElement>

Pass a ref to the input element. Ignored if the field has several inputs.

label?: ReactNode

The label content. Ignored if the field has several inputs.

lang: "sv" | "en"
loading?: boolean

If true, calls renderLoading instead of rendering the day calendar. Can be used to preload information and show it in calendar.

false
localeText?: PickersInputComponentLocaleText<Date>

Locale for components texts. Allows overriding texts coming from LocalizationProvider and theme.

maxDate?: Date

Maximal selectable date.

minDate?: Date

Minimal selectable date.

name?: string

Name attribute used by the input element in the Field. Ignored if the field has several inputs.

onAccept?: ((value: DateRange<Date>) => void)

Callback fired when the value is accepted.

Type declaration

    • (value): void
    • Parameters

      • value: DateRange<Date>

        The value that was just accepted.

      Returns void

onChange?: ((value: DateRange<Date>, context: PickerChangeHandlerContext<DateRangeValidationError>) => void)

Callback fired when the value changes.

Type declaration

    • (value, context): void
    • Parameters

      • value: DateRange<Date>

        The new value.

      • context: PickerChangeHandlerContext<DateRangeValidationError>

        The context containing the validation result of the current value.

      Returns void

onClose?: (() => void)

Callback fired when the popup requests to be closed. Use in controlled mode (see open).

onError?: ((error: DateRangeValidationError, value: DateRange<Date>) => void)

Callback fired when the error associated to the current value changes. If the error has a non-null value, then the TextField will be rendered in error state.

Type declaration

    • (error, value): void
    • Parameters

      • error: DateRangeValidationError

        The new error describing why the current value is not valid.

      • value: DateRange<Date>

        The value associated to the error.

      Returns void

onMonthChange?: ((month: Date) => void)

Callback fired on month change.

Type declaration

    • (month): void
    • Parameters

      • month: Date

        The new month.

      Returns void

onOpen?: (() => void)

Callback fired when the popup requests to be opened. Use in controlled mode (see open).

onRangePositionChange?: ((rangePosition: RangePosition) => void)

Callback fired when the range position changes.

Type declaration

    • (rangePosition): void
    • Parameters

      • rangePosition: RangePosition

        The new range position.

      Returns void

onSelectedSectionsChange?: ((newValue: FieldSelectedSections) => void)

Callback fired when the selected sections change.

Type declaration

    • (newValue): void
    • Parameters

      • newValue: FieldSelectedSections

        The new selected sections.

      Returns void

open?: boolean

Control the popup or dialog open state.

false
rangePosition?: RangePosition

The position in the currently edited date range. Used when the component position is controlled.

readOnly?: boolean
reduceAnimations?: boolean

If true, disable heavy animations.

@media(prefers-reduced-motion: reduce) || navigator.userAgent matches Android <10 or iOS <13

referenceDate?: Date

The date used to generate the new value when both value and defaultValue are empty.

The closest valid date-time using the validation props, except callbacks like shouldDisable<...>.

renderLoading?: (() => ReactNode)

Component displaying when passed loading true.

Type declaration

    • (): ReactNode
    • Returns ReactNode

      The node to render when loading.

() => "..."
selectedSections?: FieldSelectedSections

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 FieldSectionType 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.
shouldDisableDate?: ((day: Date, position: "start" | "end") => boolean)

Disable specific date.

Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.

Type declaration

    • (day, position): boolean
    • Parameters

      • day: Date

        The date to test.

      • position: "start" | "end"

        The date to test, 'start' or 'end'.

      Returns boolean

      Returns true if the date should be disabled.

showDaysOutsideCurrentMonth?: boolean

If true, days outside the current month are rendered:

  • if fixedWeekNumber is defined, renders days to have the weeks requested.

  • if fixedWeekNumber is not defined, renders day to fill the first and last week of the current month.

  • ignored if calendars equals more than 1 on range pickers.

false
slotProps?: DateRangePickerSlotsComponentsProps<Date>

The props used for each component slot.

{}
slots?: UncapitalizeObjectKeys<DateRangePickerSlotsComponents<Date>>

Overridable component slots.

{}
sx?: SxProps<Theme>

The system prop that allows defining system overrides as well as additional CSS styles.

timezone?: string

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 documention for more details.

The timezone of the value or defaultValue prop is defined, 'default' otherwise.

value?: DateRange<Date>

The selected value. Used when the component is controlled.

viewRenderers?: Partial<PickerViewRendererLookup<DateRange<Date>, "day", DateRangeViewRendererProps<Date, "day">, {}>>

Define custom view renderers for each section. If null, the section will only have field editing. If undefined, internally defined view will be the used.