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) => void value: The new value. | |
readOnly | bool | false | If true picker is readonly |
referenceDate | any | The closest valid year using the validation props, except callbacks such as `shouldDisableYear`. | The date used to generate the new value when both value and defaultValue are empty. |
shouldDisableYear | func | Disable specific year. Signature: function(year: TDate) => boolean year: 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. | |
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 the timezones documention 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
styleOverrides
property in a custom theme.