interface DateCalendarProps {
    autoFocus?: boolean;
    classes?: Partial<DateCalendarClasses>;
    className?: string;
    components?: DateCalendarSlotsComponent<Date>;
    componentsProps?: DateCalendarSlotsComponentsProps<Date>;
    customTranslation?: DeepPartial<Translation>;
    dayOfWeekFormatter?: ((day: string, date: Date) => string);
    defaultCalendarMonth?: Date;
    defaultValue?: null | Date;
    disabled?: boolean;
    disableFuture?: boolean;
    disableHighlightToday?: boolean;
    disablePast?: boolean;
    displayWeekNumber?: boolean;
    fixedWeekNumber?: number;
    focusedView?: null | DateView;
    hasActionButtons?: boolean;
    hasWeekNumbers?: boolean;
    isLoading?: boolean;
    lang: "sv" | "en";
    loading?: boolean;
    maxDate?: Date;
    minDate?: Date;
    monthsPerRow?: 3 | 4;
    onChange?: ((newValue: Date, selectionState?: unknown, selectedView?: ViewType) => void);
    onClose?: (() => void);
    onFocusedViewChange?: ((view: DateView, hasFocus: boolean) => void);
    onMonthChange?: ((month: Date) => void);
    onViewChange?: ((view: DateView) => void);
    onYearChange?: ((year: Date) => void);
    openTo?: DateView;
    outlined?: boolean;
    readOnly?: boolean;
    reduceAnimations?: boolean;
    referenceDate?: Date;
    renderLoading?: (() => ReactNode);
    secondaryView?: "month" | "year";
    shouldDisableDate?: ((day: Date) => boolean);
    shouldDisableMonth?: ((month: Date) => boolean);
    shouldDisableYear?: ((year: Date) => boolean);
    showDaysOutsideCurrentMonth?: boolean;
    slotProps?: DateCalendarSlotsComponentsProps<Date>;
    slots?: UncapitalizeObjectKeys<DateCalendarSlotsComponent<Date>>;
    sx?: SxProps<Theme>;
    timezone?: string;
    timeZone?: string;
    titleStyle?: "h2" | "h3" | "h4";
    value?: null | Date;
    view?: DateView;
    views?: readonly DateView[];
    yearsPerRow?: 3 | 4;
}

Hierarchy

  • DateCalendarProps<Date>
    • DateCalendarProps

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.
classes?: Partial<DateCalendarClasses>

Override or extend the styles applied to the component.

className?: string
components?: DateCalendarSlotsComponent<Date>

Overridable components.

{}

Please use slots.

componentsProps?: DateCalendarSlotsComponentsProps<Date>

The props used for each component slot.

{}

Please use slotProps.

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 and defaultValue are empty.

Consider using referenceDate instead.

defaultValue?: null | Date

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

disabled?: boolean

If true, the component is disabled.

disableFuture?: boolean

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

disableHighlightToday?: boolean

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

false
disablePast?: boolean

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

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
focusedView?: null | DateView

Controlled focused view.

hasActionButtons?: boolean

Render action buttons Cancel and Ok. If true, onAccept only fires on Ok button

hasWeekNumbers?: boolean

Set this to true the picker should show the week numbers next to dates.

isLoading?: boolean

If true, a loading skeleton will be rendered instead of the component.

lang: "sv" | "en"

Language used for localization and date formatting.

loading?: boolean

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

false
maxDate?: Date

Maximal selectable date.

minDate?: Date

Minimal selectable date.

monthsPerRow?: 3 | 4

Months rendered per row.

3
onChange?: ((newValue: Date, selectionState?: unknown, selectedView?: ViewType) => void)

Callback when Calendar changes.

onClose?: (() => void)

Callback when Calendar is requested to be closed.

onFocusedViewChange?: ((view: DateView, hasFocus: boolean) => void)

Callback fired on focused view change.

Type declaration

    • (view, hasFocus): void
    • Parameters

      • view: DateView

        The new view to focus or not.

      • hasFocus: boolean

        true if the view should be focused.

      Returns void

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

Callback fired on month change.

Type declaration

    • (month): void
    • Parameters

      • month: Date

        The new month.

      Returns void

onViewChange?: ((view: DateView) => void)

Callback fired on view change.

Type declaration

    • (view): void
    • Parameters

      • view: DateView

        The new view.

      Returns void

onYearChange?: ((year: Date) => void)

Callback fired on year change.

Type declaration

    • (year): void
    • Parameters

      • year: Date

        The new year.

      Returns void

openTo?: DateView

The default visible view. Used when the component view is not controlled. Must be a valid option from views list.

outlined?: boolean

If true the calendar will have a border and white background. Default is false = transparent

readOnly?: boolean

Make picker read only.

false
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 using the validation props, except callbacks such as shouldDisableDate.

renderLoading?: (() => ReactNode)

Component displaying when passed loading true.

Type declaration

    • (): ReactNode
    • Returns ReactNode

      The node to render when loading.

() => <span data-mui-test="loading-progress">...</span>
secondaryView?: "month" | "year"

Specifies the default calendar view when the component is rendered.

shouldDisableDate?: ((day: Date) => 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): boolean
    • Parameters

      • day: Date

        The date to test.

      Returns boolean

      If true the date will be disabled.

shouldDisableMonth?: ((month: Date) => boolean)

Disable specific month.

Type declaration

    • (month): boolean
    • Parameters

      • month: Date

        The month to test.

      Returns boolean

      If true, the month will be disabled.

shouldDisableYear?: ((year: Date) => boolean)

Disable specific year.

Type declaration

    • (year): boolean
    • Parameters

      • year: Date

        The year to test.

      Returns boolean

      If true, the year will 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?: DateCalendarSlotsComponentsProps<Date>

The props used for each component slot.

{}
slots?: UncapitalizeObjectKeys<DateCalendarSlotsComponent<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.

timeZone?: string

Time zone for the calendar.

titleStyle?: "h2" | "h3" | "h4"

Style calendar heading as h2, h3 or h4. Defaults to h2

value?: null | Date

Date value of the datepicker, in yyyy-MM-dd format.

view?: DateView

The visible view. Used when the component view is controlled. Must be a valid option from views list.

views?: readonly DateView[]

Available views.

yearsPerRow?: 3 | 4

Years rendered per row.

3