2016-05-22 11:03:07 +08:00
---
category: Components
2016-11-09 14:43:32 +08:00
type: Data Display
2016-05-22 11:03:07 +08:00
cols: 1
title: Calendar
2020-05-31 11:48:34 +08:00
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
2016-05-22 11:03:07 +08:00
---
2016-11-29 17:13:24 +08:00
Container for displaying data in calendar form.
2016-05-22 11:03:07 +08:00
2016-09-10 13:43:30 +08:00
## When To Use
2016-05-22 11:03:07 +08:00
2017-09-16 11:29:05 +08:00
When data is in the form of dates, such as schedules, timetables, prices calendar, lunar calendar. This component also supports Year/Month switch.
2016-05-22 11:03:07 +08:00
## API
2017-02-23 15:57:05 +08:00
```jsx
2016-05-22 11:03:07 +08:00
< Calendar
dateCellRender={dateCellRender}
monthCellRender={monthCellRender}
onPanelChange={onPanelChange}
2017-03-03 15:26:23 +08:00
onSelect={onSelect}
2016-05-22 11:03:07 +08:00
/>
```
2019-05-26 13:09:06 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
2022-06-06 16:28:00 +08:00
| dateCellRender | Customize the display of the date cell, the returned content will be appended to the cell | function(date: Moment): ReactNode | - | |
| dateFullCellRender | Customize the display of the date cell, the returned content will override the cell | function(date: Moment): ReactNode | - | |
2020-07-01 22:37:55 +08:00
| defaultValue | The date selected by default | [moment ](http://momentjs.com/ ) | - | |
2022-06-06 16:28:00 +08:00
| disabledDate | Function that specifies the dates that cannot be selected, `currentDate` is same moment object as `value` prop which you shouldn't mutate it](https://github.com/ant-design/ant-design/issues/30987) | (currentDate: Moment) => boolean | - | |
2020-06-17 23:18:14 +08:00
| fullscreen | Whether to display in full-screen | boolean | true | |
2022-06-06 16:28:00 +08:00
| headerRender | Render custom header in panel | function(object:{value: Moment, type: string, onChange: f(), onTypeChange: f()}) | - | |
2020-07-01 22:37:55 +08:00
| locale | The calendar's locale | object | [(default) ](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json ) | |
2019-05-26 13:09:06 +08:00
| mode | The display mode of the calendar | `month` \| `year` | `month` | |
2022-06-06 16:28:00 +08:00
| monthCellRender | Customize the display of the month cell, the returned content will be appended to the cell | function(date: Moment): ReactNode | - | |
| monthFullCellRender | Customize the display of the month cell, the returned content will override the cell | function(date: Moment): ReactNode | - | |
2020-07-01 22:37:55 +08:00
| validRange | To set valid range | \[[moment ](http://momentjs.com/ ), [moment ](http://momentjs.com/ )] | - | |
| value | The current selected date | [moment ](http://momentjs.com/ ) | - | |
2022-06-06 16:28:00 +08:00
| onChange | Callback for when date changes | function(date: Moment) | - | |
| onPanelChange | Callback for when panel changes | function(date: Moment, mode: string) | - | |
| onSelect | Callback for when a date is selected | function(date: Moment) | - | |
2020-01-02 16:05:59 +08:00
## FAQ
2022-07-12 13:10:20 +08:00
### How to use Calendar with customize date library like dayjs?
See [How to use Calendar with customize date library like dayjs ](/docs/react/replace-moment#Calendar )
### How to set locale for date-related components?
See [How to set locale for date-related components ](/components/date-picker/#Localization )
### Date-related components locale is not working?
See FAQ [Date-related-components-locale-is-not-working? ](/docs/react/faq#Date-related-components-locale-is-not-working? )