---
order: 4
title:
zh-CN: 自定义头部
en-US: Customize Header
---
## zh-CN
自定义日历头部内容。
## en-US
Customize Calendar header content.
```tsx
import { Calendar, Col, Radio, Row, Select, Typography } from 'antd';
import type { CalendarMode } from 'antd/lib/calendar/generateCalendar';
import type { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import dayLocaleData from 'dayjs/plugin/localeData';
import React from 'react';
dayjs.extend(dayLocaleData);
const App: React.FC = () => {
const onPanelChange = (value: Dayjs, mode: CalendarMode) => {
console.log(value.format('YYYY-MM-DD'), mode);
};
return (
{
const start = 0;
const end = 12;
const monthOptions = [];
let current = value.clone();
const localeData = value.localeData();
const months = [];
for (let i = 0; i < 12; i++) {
current = current.month(i);
months.push(localeData.monthsShort(current));
}
for (let index = start; index < end; index++) {
monthOptions.push(
{months[index]}
,
);
}
const month = value.month();
const year = value.year();
const options = [];
for (let i = year - 10; i < year + 10; i += 1) {
options.push(
{i}
,
);
}
return (
Custom header
onTypeChange(e.target.value)}
value={type}
>
Month
Year
);
}}
onPanelChange={onPanelChange}
/>
);
};
export default App;
```
```css
.site-calendar-customize-header-wrapper {
width: 300px;
border: 1px solid #f0f0f0;
border-radius: 2px;
}
```