logoNamu Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
1.0.0
  • Components Overview
  • General
    • Button
    • FloatButtonNew
    • Icon
    • Typography
  • Layout
    • Divider
    • Grid
    • Layout
    • Space
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPickerNew
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCodeNew
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • TourNew
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • AppNew
    • ConfigProvider
When To Use
Examples
Basic
Notice Calendar
Card
Selectable Calendar
Lunar Calendar
Customize Header
API
Design Token
FAQ
How to use Calendar with customize date library?
How to set locale for date-related components?
Date-related components locale is not working?
How to get date from panel click?

Calendar

  • BadgeCard

    Resources

    Namu Design Charts
    Namu Design Pro
    Namu Design Pro Components
    Namu Design Mobile
    Namu Design Mini
    Namu Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    ahooks-React Hooks Library
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Namu Design
    Medium
    Twitter
    yuqueNamu Design in YuQue
    Namu Design in Zhihu
    Experience Cloud Blog
    seeconfSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTechMore Products

    yuqueYuQue-Document Collaboration Platform
    AntVAntV-Data Visualization
    EggEgg-Enterprise Node.js Framework
    kitchenKitchen-Sketch Toolkit
    xtechAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Namu Design Community

    Container for displaying data in calendar form.

    When To Use

    When data is in the form of dates, such as schedules, timetables, prices calendar, lunar calendar. This component also supports Year/Month switch.

    Examples

    Basic

    A basic calendar component with Year/Month switch.

    expand codeexpand code
    Notice Calendar

    This component can be rendered by using dateCellRender and monthCellRender with the data you need.

    expand codeexpand code
    Card

    Nested inside a container element for rendering in limited space.

    expand codeexpand code
    Selectable Calendar

    A basic calendar component with Year/Month switch.

    expand codeexpand code
    Lunar Calendar

    Display lunar calendar, solar terms and other information.

    expand codeexpand code
    Customize Header

    Customize Calendar header content.

    expand codeexpand code

    API

    Common props ref:Common props

    Note: Part of the Calendar's locale is read from value. So, please set the locale of dayjs correctly.

    // The default locale is en-US, if you want to use other locale, just set locale in entry file globally.
    // import dayjs from 'dayjs';
    // import 'dayjs/locale/zh-cn';
    // dayjs.locale('zh-cn');
    <Calendar
    dateCellRender={dateCellRender}
    monthCellRender={monthCellRender}
    onPanelChange={onPanelChange}
    onSelect={onSelect}
    />
    PropertyDescriptionTypeDefaultVersion
    dateCellRenderCustomize the display of the date cell, the returned content will be appended to the cellfunction(date: Dayjs): ReactNode-
    dateFullCellRenderCustomize the display of the date cell, the returned content will override the cellfunction(date: Dayjs): ReactNode-
    defaultValueThe date selected by defaultdayjs-
    disabledDateFunction that specifies the dates that cannot be selected, currentDate is same dayjs object as value prop which you shouldn't mutate it](https://github.com/ant-design/ant-design/issues/30987)(currentDate: Dayjs) => boolean-
    fullscreenWhether to display in full-screenbooleantrue
    headerRenderRender custom header in panelfunction(object:{value: Dayjs, type: string, onChange: f(), onTypeChange: f()})-
    localeThe calendar's localeobject(default)
    modeThe display mode of the calendarmonth | yearmonth
    monthCellRenderCustomize the display of the month cell, the returned content will be appended to the cellfunction(date: Dayjs): ReactNode-
    monthFullCellRenderCustomize the display of the month cell, the returned content will override the cellfunction(date: Dayjs): ReactNode-
    validRangeTo set valid range[dayjs, dayjs]-
    valueThe current selected datedayjs-
    onChangeCallback for when date changesfunction(date: Dayjs)-
    onPanelChangeCallback for when panel changesfunction(date: Dayjs, mode: string)-
    onSelectCallback for when a date is selected, include source infofunction(date: Dayjs, info: { source: 'year' | 'month' | 'date' | 'customize' })-info: 5.6.0

    Design Token

    Component Token

    Global Token

    FAQ

    How to use Calendar with customize date library?

    See Use custom date library

    How to set locale for date-related components?

    See How to set locale for date-related components

    Date-related components locale is not working?

    See FAQ Date-related-components-locale-is-not-working?

    How to get date from panel click?

    onSelect provide info.source to help on this:

    <Calendar
    onSelect={(date, { source }) => {
    if (source === 'date') {
    console.log('Panel Select:', source);
    }
    }}
    />
    2023
    Sep
    SuMoTuWeThFrSa
    27
    28
    29
    30
    31
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    01
    02
    03
    04
    05
    06
    07
    2023
    Sep
    SuMoTuWeThFrSa
    27
      28
        29
          30
            31
              01
                02
                  03
                    04
                      05
                        06
                          07
                            08
                            • This is warning event.
                            • This is usual event.
                            09
                              10
                              • This is warning event.
                              • This is usual event.
                              • This is error event.
                              11
                                12
                                  13
                                    14
                                      15
                                      • This is warning event
                                      • This is very long usual event......
                                      • This is error event 1.
                                      • This is error event 2.
                                      • This is error event 3.
                                      • This is error event 4.
                                      16
                                        17
                                          18
                                            19
                                              20
                                                21
                                                  22
                                                    23
                                                      24
                                                        25
                                                          26
                                                            27
                                                              28
                                                                29
                                                                  30
                                                                    01
                                                                      02
                                                                        03
                                                                          04
                                                                            05
                                                                              06
                                                                                07
                                                                                  2023
                                                                                  Sep
                                                                                  SuMoTuWeThFrSa
                                                                                  27
                                                                                  28
                                                                                  29
                                                                                  30
                                                                                  31
                                                                                  01
                                                                                  02
                                                                                  03
                                                                                  04
                                                                                  05
                                                                                  06
                                                                                  07
                                                                                  08
                                                                                  09
                                                                                  10
                                                                                  11
                                                                                  12
                                                                                  13
                                                                                  14
                                                                                  15
                                                                                  16
                                                                                  17
                                                                                  18
                                                                                  19
                                                                                  20
                                                                                  21
                                                                                  22
                                                                                  23
                                                                                  24
                                                                                  25
                                                                                  26
                                                                                  27
                                                                                  28
                                                                                  29
                                                                                  30
                                                                                  01
                                                                                  02
                                                                                  03
                                                                                  04
                                                                                  05
                                                                                  06
                                                                                  07
                                                                                  You selected date: 2017-01-25
                                                                                  2017
                                                                                  Jan
                                                                                  SuMoTuWeThFrSa
                                                                                  01
                                                                                  02
                                                                                  03
                                                                                  04
                                                                                  05
                                                                                  06
                                                                                  07
                                                                                  08
                                                                                  09
                                                                                  10
                                                                                  11
                                                                                  12
                                                                                  13
                                                                                  14
                                                                                  15
                                                                                  16
                                                                                  17
                                                                                  18
                                                                                  19
                                                                                  20
                                                                                  21
                                                                                  22
                                                                                  23
                                                                                  24
                                                                                  25
                                                                                  26
                                                                                  27
                                                                                  28
                                                                                  29
                                                                                  30
                                                                                  31
                                                                                  01
                                                                                  02
                                                                                  03
                                                                                  04
                                                                                  05
                                                                                  06
                                                                                  07
                                                                                  08
                                                                                  09
                                                                                  10
                                                                                  11
                                                                                  2023年(癸卯兔年)
                                                                                  9月(七月)
                                                                                  SuMoTuWeThFrSa
                                                                                  27
                                                                                  十二
                                                                                  28
                                                                                  十三
                                                                                  29
                                                                                  十四
                                                                                  30
                                                                                  十五
                                                                                  31
                                                                                  十六
                                                                                  1
                                                                                  十七
                                                                                  2
                                                                                  十八
                                                                                  3
                                                                                  十九
                                                                                  4
                                                                                  二十
                                                                                  5
                                                                                  廿一
                                                                                  6
                                                                                  廿二
                                                                                  7
                                                                                  廿三
                                                                                  8
                                                                                  白露
                                                                                  9
                                                                                  廿五
                                                                                  10
                                                                                  廿六
                                                                                  11
                                                                                  廿七
                                                                                  12
                                                                                  廿八
                                                                                  13
                                                                                  廿九
                                                                                  14
                                                                                  三十
                                                                                  15
                                                                                  初一
                                                                                  16
                                                                                  初二
                                                                                  17
                                                                                  初三
                                                                                  18
                                                                                  初四
                                                                                  19
                                                                                  初五
                                                                                  20
                                                                                  初六
                                                                                  21
                                                                                  初七
                                                                                  22
                                                                                  初八
                                                                                  23
                                                                                  秋分
                                                                                  24
                                                                                  初十
                                                                                  25
                                                                                  十一
                                                                                  26
                                                                                  十二
                                                                                  27
                                                                                  十三
                                                                                  28
                                                                                  十四
                                                                                  29
                                                                                  十五
                                                                                  30
                                                                                  十六
                                                                                  1
                                                                                  十七
                                                                                  2
                                                                                  十八
                                                                                  3
                                                                                  十九
                                                                                  4
                                                                                  二十
                                                                                  5
                                                                                  廿一
                                                                                  6
                                                                                  廿二
                                                                                  7
                                                                                  廿三

                                                                                  Custom header

                                                                                  2023
                                                                                  Sep
                                                                                  SuMoTuWeThFrSa
                                                                                  27
                                                                                  28
                                                                                  29
                                                                                  30
                                                                                  31
                                                                                  01
                                                                                  02
                                                                                  03
                                                                                  04
                                                                                  05
                                                                                  06
                                                                                  07
                                                                                  08
                                                                                  09
                                                                                  10
                                                                                  11
                                                                                  12
                                                                                  13
                                                                                  14
                                                                                  15
                                                                                  16
                                                                                  17
                                                                                  18
                                                                                  19
                                                                                  20
                                                                                  21
                                                                                  22
                                                                                  23
                                                                                  24
                                                                                  25
                                                                                  26
                                                                                  27
                                                                                  28
                                                                                  29
                                                                                  30
                                                                                  01
                                                                                  02
                                                                                  03
                                                                                  04
                                                                                  05
                                                                                  06
                                                                                  07