Interface: MuiDatePickerProps
Props for the MuiDatePicker component.
Extends
Omit<DatePickerProps<any,any>,"reduceAnimations">.Pick<MuiControlProps,"error"|"helperText"|"readOnly"|"required">
Properties
autoFocus?
optionalautoFocus: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
dayview). - the
inputelement if there is a field rendered.
Inherited from
Omit.autoFocus
className?
optionalclassName:string
Inherited from
Omit.className
closeOnSelect?
optionalcloseOnSelect:boolean
If true, the popover or modal will close after submitting the full date.
Default
true for desktop, false for mobile (based on the chosen wrapper and desktopModeMediaQuery prop).
Inherited from
Omit.closeOnSelect
dayOfWeekFormatter()?
optionaldayOfWeekFormatter: (date) =>string
Formats the day of week displayed in the calendar header.
Parameters
date
any
The date of the day of week provided by the adapter.
Returns
string
The name to display.
Default
(date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
Inherited from
Omit.dayOfWeekFormatter
defaultValue?
optionaldefaultValue:any
The default value. Used when the component is not controlled.
Inherited from
Omit.defaultValue
desktopModeMediaQuery?
optionaldesktopModeMediaQuery:string
CSS media query when Mobile mode will be changed to Desktop.
Default
'@media (pointer: fine)'
Example
'@media (min-width: 720px)' or theme.breakpoints.up("sm")
Inherited from
Omit.desktopModeMediaQuery
disabled?
optionaldisabled:boolean
If true, the picker and text field are disabled.
Default
false
Inherited from
Omit.disabled
disableFuture?
optionaldisableFuture:boolean
If true, disable values after the current date for date components, time for time components and both for date time components.
Default
false
Inherited from
Omit.disableFuture
disableHighlightToday?
optionaldisableHighlightToday:boolean
If true, today's date is rendering without highlighting with circle.
Default
false
Inherited from
Omit.disableHighlightToday
disableOpenPicker?
optionaldisableOpenPicker:boolean
If true, the open picker button will not be rendered (renders only the field).
Default
false
Inherited from
Omit.disableOpenPicker
disablePast?
optionaldisablePast:boolean
If true, disable values before the current date for date components, time for time components and both for date time components.
Default
false
Inherited from
Omit.disablePast
displayWeekNumber?
optionaldisplayWeekNumber:boolean
If true, the week number will be display in the calendar.
Inherited from
Omit.displayWeekNumber
enableAccessibleFieldDOMStructure?
optionalenableAccessibleFieldDOMStructure:any
Default
false
Inherited from
Omit.enableAccessibleFieldDOMStructure
error?
optionalerror:boolean
If true, the label is displayed in an error state.
Default
false
Inherited from
Pick.error
fixedWeekNumber?
optionalfixedWeekNumber: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
Inherited from
Omit.fixedWeekNumber
format?
optionalformat:string
Format of the date when rendered in the input(s).
Defaults to localized format based on the used views.
Inherited from
Omit.format
formatDensity?
optionalformatDensity:"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.
Default
"dense"
Inherited from
Omit.formatDensity
helperText?
optionalhelperText:string
The helper text for the form control.
Inherited from
Pick.helperText
inputRef?
optionalinputRef:Ref<HTMLInputElement>
Pass a ref to the input element.
Inherited from
Omit.inputRef
label?
optionallabel:ReactNode
The label content.
Inherited from
Omit.label
loading?
optionalloading:boolean
If true, calls renderLoading instead of rendering the day calendar.
Can be used to preload information and show it in calendar.
Default
false
Inherited from
Omit.loading
localeText?
optionallocaleText:PickersInputComponentLocaleText<any>
Locale for components texts.
Allows overriding texts coming from LocalizationProvider and theme.
Inherited from
Omit.localeText
maxDate?
optionalmaxDate:any
Maximal selectable date.
Default
2099-12-31
Inherited from
Omit.maxDate
minDate?
optionalminDate:any
Minimal selectable date.
Default
1900-01-01
Inherited from
Omit.minDate
monthsPerRow?
optionalmonthsPerRow:3|4
Months rendered per row.
Default
3
Inherited from
Omit.monthsPerRow
name?
optionalname:string
Name attribute used by the input element in the Field.
Inherited from
Omit.name
onAccept()?
optionalonAccept: (value,context) =>void
Callback fired when the value is accepted.
Parameters
value
any
The value that was just accepted.
context
PickerChangeHandlerContext<DateValidationError>
The context containing the validation result of the current value.
Returns
void
Inherited from
Omit.onAccept
onChange()?
optionalonChange: (value,context) =>void
Callback fired when the value changes.
Parameters
value
any
The new value.
context
PickerChangeHandlerContext<DateValidationError>
The context containing the validation result of the current value.
Returns
void
Inherited from
Omit.onChange
onClose()?
optionalonClose: () =>void
Callback fired when the popup requests to be closed.
Use in controlled mode (see open).
Returns
void
Inherited from
Omit.onClose
onError()?
optionalonError: (error,value) =>void
Callback fired when the error associated with the current value changes.
When a validation error is detected, the error parameter contains a non-null value.
This can be used to render an appropriate form error.
Parameters
error
DateValidationError
The reason why the current value is not valid.
value
any
The value associated with the error.
Returns
void
Inherited from
Omit.onError
onMonthChange()?
optionalonMonthChange: (month) =>void
Callback fired on month change.
Parameters
month
any
The new month.
Returns
void
Inherited from
Omit.onMonthChange
onOpen()?
optionalonOpen: () =>void
Callback fired when the popup requests to be opened.
Use in controlled mode (see open).
Returns
void
Inherited from
Omit.onOpen
onSelectedSectionsChange()?
optionalonSelectedSectionsChange: (newValue) =>void
Callback fired when the selected sections change.
Parameters
newValue
FieldSelectedSections
The new selected sections.
Returns
void
Inherited from
Omit.onSelectedSectionsChange
onViewChange()?
optionalonViewChange: (view) =>void
Callback fired on view change.
Parameters
view
DateView
The new view.
Returns
void
Inherited from
Omit.onViewChange
onYearChange()?
optionalonYearChange: (year) =>void
Callback fired on year change.
Parameters
year
any
The new year.
Returns
void
Inherited from
Omit.onYearChange
open?
optionalopen:boolean
Control the popup or dialog open state.
Default
false
Inherited from
Omit.open
openTo?
optionalopenTo:DateView
The default visible view.
Used when the component view is not controlled.
Must be a valid option from views list.
Inherited from
Omit.openTo
orientation?
optionalorientation:"landscape"|"portrait"
Force rendering in particular orientation.
Inherited from
Omit.orientation
readOnly?
optionalreadOnly:boolean
Inherited from
Omit.readOnly
referenceDate?
optionalreferenceDate:any
The date used to generate the new value when both value and defaultValue are empty.
Default
The closest valid date-time using the validation props, except callbacks like shouldDisable<...>.
Inherited from
Omit.referenceDate
renderLoading()?
optionalrenderLoading: () =>ReactNode
Component displaying when passed loading true.
Returns
ReactNode
The node to render when loading.
Default
() => <span>...</span>
Inherited from
Omit.renderLoading
required?
optionalrequired:boolean
If true, the label will indicate that the input is required.
Default
false
Inherited from
Pick.required
selectedSections?
optionalselectedSections:FieldSelectedSections
The currently selected sections. This prop accepts four formats:
- If a number is provided, the section at this index will be selected.
- If a string of type
FieldSectionTypeis provided, the first section with that name will be selected. - If
"all"is provided, all the sections will be selected. - If
nullis provided, no section will be selected. If not provided, the selected sections will be handled internally.
Inherited from
Omit.selectedSections
shouldDisableDate()?
optionalshouldDisableDate: (day) =>boolean
Disable specific date.
Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
Parameters
day
any
The date to test.
Returns
boolean
If true the date will be disabled.
Inherited from
Omit.shouldDisableDate
shouldDisableMonth()?
optionalshouldDisableMonth: (month) =>boolean
Disable specific month.
Parameters
month
any
The month to test.
Returns
boolean
If true, the month will be disabled.
Inherited from
Omit.shouldDisableMonth
shouldDisableYear()?
optionalshouldDisableYear: (year) =>boolean
Disable specific year.
Parameters
year
any
The year to test.
Returns
boolean
If true, the year will be disabled.
Inherited from
Omit.shouldDisableYear
showDaysOutsideCurrentMonth?
optionalshowDaysOutsideCurrentMonth:boolean
If true, days outside the current month are rendered:
-
if
fixedWeekNumberis defined, renders days to have the weeks requested. -
if
fixedWeekNumberis not defined, renders day to fill the first and last week of the current month. -
ignored if
calendarsequals more than1on range pickers.
Default
false
Inherited from
Omit.showDaysOutsideCurrentMonth
slotProps?
optionalslotProps:DatePickerSlotProps<any,any>
The props used for each component slot.
Default
{}
Inherited from
Omit.slotProps
slots?
optionalslots:DatePickerSlots<any>
Overridable component slots.
Default
{}
Inherited from
Omit.slots
sx?
optionalsx:SxProps<Theme>
The system prop that allows defining system overrides as well as additional CSS styles.
Inherited from
Omit.sx
timezone?
optionaltimezone: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
See the timezones documentation for more details.
Default
The timezone of the value or defaultValue prop is defined, 'default' otherwise.
Inherited from
Omit.timezone
value?
optionalvalue:any
The selected value. Used when the component is controlled.
Inherited from
Omit.value
view?
optionalview:DateView
The visible view.
Used when the component view is controlled.
Must be a valid option from views list.
Inherited from
Omit.view
viewRenderers?
optionalviewRenderers:Partial<DatePickerViewRenderers<any,DateView, { }>>
Define custom view renderers for each section.
If null, the section will only have field editing.
If undefined, internally defined view will be used.
Inherited from
Omit.viewRenderers
views?
optionalviews: readonlyDateView[]
Available views.
Inherited from
Omit.views
yearsOrder?
optionalyearsOrder:"asc"|"desc"
Years are displayed in ascending (chronological) order by default.
If desc, years are displayed in descending order.
Default
'asc'
Inherited from
Omit.yearsOrder
yearsPerRow?
optionalyearsPerRow:3|4
Years rendered per row.
Default
4 on desktop, 3 on mobile
Inherited from
Omit.yearsPerRow