YearCalendar API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import { YearCalendar } from '@mui/x-date-pickers-pro/YearCalendar';
// or
import { YearCalendar } from '@mui/x-date-pickers/YearCalendar';
// or
import { YearCalendar } from '@mui/x-date-pickers-pro';
// or
import { YearCalendar } from '@mui/x-date-pickers';Component name
The nameMuiYearCalendar can be used when providing default props or style overrides in the theme.Props
Props of the native component are also available.
| Name | Type | Default | Description |
|---|---|---|---|
| classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
| className | string | className applied to the root element. | |
| defaultValue | any | The default selected value. Used when the component is not controlled. | |
| disabled | bool | false | If true picker is disabled |
| disableFuture | bool | false | If true, disable values after the current date for date components, time for time components and both for date time components. |
| disableHighlightToday | bool | false | If true, today's date is rendering without highlighting with circle. |
| disablePast | bool | false | If true, disable values before the current date for date components, time for time components and both for date time components. |
| maxDate | any | Maximal selectable date. | |
| minDate | any | Minimal selectable date. | |
| onChange | func | Callback fired when the value changes. Signature: function(value: TDate | null) => voidvalue: The new value. | |
| readOnly | bool | false | If true picker is readonly |
| shouldDisableYear | func | Disable specific year. Signature: function(year: TDate) => booleanyear: The year to test. returns (boolean): If true, the year will be disabled. | |
| sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | |
| value | any | The selected value. Used when the component is controlled. | |
| yearsPerRow | 3 | 4 | 3 | Years rendered per row. |
The
ref is forwarded to the root element.CSS
| Rule name | Global class | Description |
|---|---|---|
| root | .MuiYearCalendar-root | Styles applied to the root 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.