logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.4.5
  • Components Overview
  • Changelog
    v6.4.5
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • 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
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Range Picker
Multiple
Need Confirm
Switchable picker
Date Format
Choose Time
Mask Format
Limit Date Range
Disabled
Disabled Date & Time
Allow Empty
Select range dates
Preset Ranges
Extra Footer
Three Sizes
Customized Cell Rendering
Customize Panel
External use panel
Buddhist Era
Status
Variants
Custom semantic dom styling
Placement
Prefix and Suffix
API
Localization
Common API
Common Methods
DatePicker
DatePicker[picker=year]
DatePicker[picker=quarter]
DatePicker[picker=month]
DatePicker[picker=week]
RangePicker
Semantic DOM
Design Token
FAQ
When set mode to DatePicker/RangePicker, cannot select year or month anymore?
Why does the date picker switch to the date panel after selecting the year instead of the month panel?
How to use DatePicker with customize date library like dayjs?
Why config dayjs.locale globally not work?
How to modify start day of week?
Why origin panel don't switch when using panelRender?
How to understand disabled time and date?

DatePicker

To select or input a date.
Importimport { DatePicker } from 'antd';
GitHub
components/date-pickerIssueOpen issues
Docs
Edit this pageLLMs.md
ColorPickerForm

Resources

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

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
Development
Design
loading

When To Use

By clicking the input box, you can select a date from a popup calendar.

Examples

API

Common props ref:Common props

There are five kinds of picker:

  • DatePicker
  • DatePicker[picker="month"]
  • DatePicker[picker="week"]
  • DatePicker[picker="year"]
  • DatePicker[picker="quarter"] (Added in 4.1.0)
  • RangePicker

Localization

The default locale is en-US, if you need to use other languages, recommend to use internationalized components provided by us at the entrance. Look at: ConfigProvider.

If there are special needs (only modifying single component language), Please use the property: locale. Example: default.

jsx
// The default locale is en-US, if you want to use other locale, just set locale in entry file globally.
// Make sure you import the relevant dayjs file as well, otherwise the locale won't change for all texts (e.g. range picker months)
import locale from 'antd/locale/zh_CN';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
<ConfigProvider locale={locale}>
<DatePicker defaultValue={dayjs('2015-01-01', 'YYYY-MM-DD')} />
</ConfigProvider>;
WARNING

When using the Next.js App Router, make sure to add 'use client' before importing Day.js locale files. This is because all Ant Design components only work on the client side, so importing locale files in RSC will not work.

Common API

The following APIs are shared by DatePicker, RangePicker.

PropertyDescriptionTypeDefaultVersionGlobal Config
allowClearCustomize clear buttonboolean | { clearIcon?: ReactNode }true5.8.0: Support object type6.4.0
borderedWhether has border style, please use variant insteadbooleantrue-×
classNameThe picker classNamestring-DatePicker: 5.7.0, RangePicker: 5.11.0
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-DatePicker: 5.25.0, RangePicker: 5.25.0
dateRenderCustom rendering function for date cells, >= 5.4.0 use cellRender instead.function(currentDate: dayjs, today: dayjs) => React.ReactNode-< 5.4.0×
cellRenderCustom rendering function for picker cells(current: dayjs, info: { originNode: React.ReactElement,today: DateType, range?: 'start' | 'end', type: PanelMode, locale?: Locale, subType?: 'hour' | 'minute' | 'second' | 'meridiem' }) => React.ReactNode-5.4.0×
componentsCustom panelsRecord<Panel | 'input', React.ComponentType>-5.14.0×
defaultOpenInitial open state of pickerboolean-×
disabledDetermine whether the DatePicker is disabledbooleanfalse×
disabledDateSpecify the date that cannot be selected(currentDate: dayjs, info: { from?: dayjs, type: Picker }) => boolean-info: 5.14.0×
dropdownClassNameThe className of popup calendar, please use classNames.popup.root insteadstring--×
formatTo set the date format, support multi-format matching when it is an array, display the first one shall prevail. refer to dayjs#format. for example: Custom FormatformatType@rc-component/picker×
orderAuto order date when multiple or range selectionbooleantrue5.14.0×
popupClassNameTo customize the className of the popup calendar, use classNames.popup.root insteadstring-4.23.0×
preserveInvalidOnBlurDon't clear the input on blur even when the typed value is invalidbooleanfalse5.14.0×
getPopupContainerTo set the container of the floating layer, while the default is to create a div element in bodyfunction(trigger)-×
inputReadOnlySet the readonly attribute of the input tag (avoids virtual keyboard on touch devices)booleanfalse×
localeLocalization configurationobjectdefault×
minDateThe minimum date, which also limits the range of panel switchingdayjs-5.14.0×
maxDateThe maximum date, which also limits the range of panel switchingdayjs-5.14.0×
modeThe picker panel mode( Cannot select year or month anymore? )time | date | month | year | decade-×
needConfirmNeed click confirm button to trigger value change. Default false when multipleboolean-5.14.0×
nextIconThe custom next iconReactNode-4.17.0×
openThe open state of pickerboolean-×
panelRenderCustomize panel render(panelNode) => ReactNode-4.5.0×
pickerSet picker typedate | week | month | quarter | yeardatequarter: 4.1.0×
placeholderThe placeholder of date inputstring | [string,string]-×
placementThe position where the selection box pops upbottomLeft bottomRight topLeft topRightbottomLeft×
popupStyleTo customize the style of the popup calendar, use styles.popup.root insteadCSSProperties{}×
prefixThe custom prefixReactNode-5.22.0×
presetsThe preset ranges for quick selection, Since 5.8.0, preset value supports callback function.{ label: React.ReactNode, value: Dayjs | (() => Dayjs) }[]-×
prevIconThe custom prev iconReactNode-4.17.0×
previewValueWhen the user selects the date hover option, the value of the input field undergoes a temporary changefalse | hoverhover6.0.0×
sizeTo determine the size of the input box, the height of large and small, are 40px and 24px respectively, while default size is 32pxlarge | medium | small-×
statusSet validation status'error' | 'warning'-4.19.0×
styleTo customize the style of the input boxCSSProperties{}DatePicker: 5.7.0, RangePicker: 5.11.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-DatePicker: 5.25.0, RangePicker: 5.25.0
suffixIconThe custom suffix iconReactNode-DatePicker: 6.3.0, RangePicker: 6.4.0
superNextIconThe custom super next iconReactNode-4.17.0×
superPrevIconThe custom super prev iconReactNode-4.17.0×
clearIcon(Only supports global configuration) Custom clear iconReactNode-×6.4.0
variantVariants of pickeroutlined | borderless | filled | underlinedoutlined5.13.0 | underlined: 5.24.0DatePicker: 5.19.0, RangePicker: 5.19.0
onClearCallback when click the clear button() => void-6.5.0×
onOpenChangeCallback function, can be executed whether the popup calendar is popped up or closedfunction(open)-×
onPanelChangeCallback when picker panel mode is changedfunction(value, mode)-×
onSelectCallback when a date is selected, please use onCalendarChange insteadfunction(value)--×

Common Methods

NameDescriptionVersion
blur()Remove focus
focus()Get focus

DatePicker

PropertyDescriptionTypeDefaultVersion
defaultPickerValueDefault panel date, will be reset when panel opendayjs-5.14.0
defaultValueTo set default date, if start time or end time is null or undefined, the date range will be an open intervaldayjs-
disabledTimeTo specify the time that cannot be selectedfunction(date)-
formatTo set the date format. refer to dayjs#formatformatTypeYYYY-MM-DD
multipleEnable multiple selection. Not support showTimebooleanfalse5.14.0
pickerValuePanel date. Used for controlled switching of panel date. Work with onPanelChangedayjs-5.14.0
renderExtraFooterRender extra footer in panel(mode) => React.ReactNode-
showNowShow the fast access of current datetimeboolean-4.4.0
showTimeTo provide an additional time selectionobject | booleanTimePicker Options
showTime.defaultValueUse showTime.defaultOpenValue insteaddayjsdayjs()5.27.3
showTime.defaultOpenValueTo set default time of selected date, demodayjsdayjs()
showWeekShow week info when in DatePickerbooleanfalse5.14.0
valueTo set datedayjs-
onChangeCallback function, can be executed when the selected time is changingfunction(date: dayjs | null, dateString: string | null)-
onOkCallback when click ok buttonfunction()-
onPanelChangeCallback function for panel changingfunction(value, mode)-

DatePicker[picker=year]

PropertyDescriptionTypeDefaultVersion
defaultValueTo set default datedayjs-
formatTo set the date format. refer to dayjs#formatformatTypeYYYY
multipleEnable multiple selectionbooleanfalse5.14.0
renderExtraFooterRender extra footer in panel() => React.ReactNode-
tagRenderCustomize tag render, only applies when multiple is set(props) => ReactNode-6.4.0
valueTo set datedayjs-
onChangeCallback function, can be executed when the selected time is changingfunction(date: dayjs | null, dateString: string | null)-

DatePicker[picker=quarter]

Added in 4.1.0.

PropertyDescriptionTypeDefaultVersion
defaultValueTo set default datedayjs-
formatTo set the date format. refer to dayjs#formatformatTypeYYYY-\QQ
multipleEnable multiple selectionbooleanfalse5.14.0
renderExtraFooterRender extra footer in panel() => React.ReactNode-
tagRenderCustomize tag render, only applies when multiple is set(props) => ReactNode-6.4.0
valueTo set datedayjs-
onChangeCallback function, can be executed when the selected time is changingfunction(date: dayjs | null, dateString: string | null)-

DatePicker[picker=month]

PropertyDescriptionTypeDefaultVersion
defaultValueTo set default datedayjs-
formatTo set the date format. refer to dayjs#formatformatTypeYYYY-MM
multipleEnable multiple selectionbooleanfalse5.14.0
renderExtraFooterRender extra footer in panel() => React.ReactNode-
tagRenderCustomize tag render, only applies when multiple is set(props) => ReactNode-6.4.0
valueTo set datedayjs-
onChangeCallback function, can be executed when the selected time is changingfunction(date: dayjs | null, dateString: string | null)-

DatePicker[picker=week]

PropertyDescriptionTypeDefaultVersion
defaultValueTo set default datedayjs-
formatTo set the date format. refer to dayjs#formatformatTypeYYYY-wo
multipleEnable multiple selectionbooleanfalse5.14.0
renderExtraFooterRender extra footer in panel(mode) => React.ReactNode-
tagRenderCustomize tag render, only applies when multiple is set(props) => ReactNode-6.4.0
valueTo set datedayjs-
onChangeCallback function, can be executed when the selected time is changingfunction(date: dayjs | null, dateString: string | null)-
showWeekShow week info when in DatePickerbooleantrue5.14.0

RangePicker

PropertyDescriptionTypeDefaultVersionGlobal Config
allowEmptyAllow start or end input leave empty[boolean, boolean][false, false]×
cellRenderCustom rendering function for picker cells(current: dayjs, info: { originNode: React.ReactElement,today: DateType, range?: 'start' | 'end', type: PanelMode, locale?: Locale, subType?: 'hour' | 'minute' | 'second' | 'meridiem' }) => React.ReactNode-5.4.0×
dateRenderCustom rendering function for date cells, >= 5.4.0 use cellRender instead.function(currentDate: dayjs, today: dayjs) => React.ReactNode-< 5.4.0×
defaultPickerValueDefault panel date, will be reset when panel open[dayjs, dayjs]-5.14.0×
defaultValueTo set default date[dayjs, dayjs]-×
disabledIf disable start or end[boolean, boolean]-×
disabledTimeTo specify the time that cannot be selectedfunction(date: dayjs, partial: start | end, info: { from?: dayjs })-info.from: 5.17.0×
formatTo set the date format. refer to dayjs#formatformatTypeYYYY-MM-DD HH:mm:ss×
idConfig input ids{ start?: string, end?: string }-5.14.0×
pickerValuePanel date. Used for controlled switching of panel date. Work with onPanelChange[dayjs, dayjs]-5.14.0×
presetsThe preset ranges for quick selection, Since 5.8.0, preset value supports callback function.{ label: React.ReactNode, value: [(Dayjs | (() => Dayjs)), (Dayjs | (() => Dayjs))] }[]-×
renderExtraFooterRender extra footer in panel() => React.ReactNode-×
separatorSet separator between inputsReact.ReactNode<SwapRightOutlined />6.3.0
showTimeTo provide an additional time selectionobject | booleanTimePicker Options×
showTime.defaultValueUse showTime.defaultOpenValue instead[dayjs, dayjs][dayjs(), dayjs()]5.27.3×
showTime.defaultOpenValueTo set default time of selected date, demo[dayjs, dayjs][dayjs(), dayjs()]×
valueTo set date[dayjs, dayjs]-×
onCalendarChangeCallback function, can be executed when the start time or the end time of the range is changing. info argument is added in 4.4.0function(dates: [dayjs, dayjs], dateStrings: [string, string], info: { range:start|end })-×
onChangeCallback function, can be executed when the selected time is changingfunction(dates: [dayjs, dayjs] | null, dateStrings: [string, string] | null)-×
onFocusTrigger when get focusfunction(event, { range: 'start' | 'end' })-range: 5.14.0×
onBlurTrigger when lose focusfunction(event, { range: 'start' | 'end' })-range: 5.14.0×

formatType

typescript
import type { Dayjs } from 'dayjs';
type Generic = string;
type GenericFn = (value: Dayjs) => string;
export type FormatType =
| Generic
| GenericFn
| Array<Generic | GenericFn>
| {
format: string;
type?: 'mask';
};

Note: type is added in 5.14.0.

Semantic DOM

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
activeBgBackground color when the input box is activatedstring#ffffff
activeBorderColorActive border colorstring#1677ff
activeShadowBox-shadow when activestring0 0 0 2px rgba(5,145,255,0.1)
addonBgBackground color of addonstringrgba(0,0,0,0.02)
cellActiveWithRangeBgBackground color of cell in rangestring#e6f4ff
cellBgDisabledBackground color of disabled cellstringrgba(0,0,0,0.04)
cellHeightHeight of cellnumber24
cellHoverBgBackground color of cell hover statestringrgba(0,0,0,0.04)
cellHoverWithRangeBgBackground color of hovered cell in rangestring#cbe0fd
cellRangeBorderColorBorder color of cell in range when pickingstring#82b4f9
cellWidthWidth of cellnumber36
errorActiveShadowBox-shadow when active in error statusstring0 0 0 2px rgba(255,38,5,0.06)
hoverBgBackground color when the input box hoversstring#ffffff
hoverBorderColorHover border colorstring#4096ff
inputFontSizeFont sizenumber14
inputFontSizeLGFont size of largenumber16
inputFontSizeSMFont size of smallnumber14
multipleItemBgBackground color of multiple tagstringrgba(0,0,0,0.06)
multipleItemBorderColorBorder color of multiple tagstringtransparent
multipleItemBorderColorDisabledBorder color of multiple tag when disabledstringtransparent
multipleItemColorDisabledText color of multiple tag when disabledstringrgba(0,0,0,0.25)
multipleItemHeightHeight of multiple tagnumber24
multipleItemHeightLGHeight of multiple tag with large sizenumber32
multipleItemHeightSMHeight of multiple tag with small sizenumber16
multipleSelectorBgDisabledBackground color of multiple selector when disabledstringrgba(0,0,0,0.04)
paddingBlockVertical padding of inputnumber4
paddingBlockLGVertical padding of large inputnumber7
paddingBlockSMVertical padding of small inputnumber0
paddingInlineHorizontal padding of inputnumber11
paddingInlineLGHorizontal padding of large inputnumber11
paddingInlineSMHorizontal padding of small inputnumber7
presetsMaxWidthMax width of preset areanumber200
presetsWidthWidth of preset areanumber120
textHeightHeight of cell textnumber40
timeCellHeightHeight of time cellnumber28
timeColumnHeightHeight of time columnnumber224
timeColumnWidthWidth of time columnnumber56
warningActiveShadowBox-shadow when active in warning statusstring0 0 0 2px rgba(255,215,5,0.1)
withoutTimeCellHeightHeight of decade/year/quarter/month/week cellnumber66
zIndexPopupz-index of popupnumber1050
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorBgContainerContainer background color, e.g: default button, input box, etc. Be sure not to confuse this with `colorBgElevated`.string#ffffff
colorBgContainerDisabledControl the background color of container in disabled state.stringrgba(0,0,0,0.04)
colorBgElevatedContainer background color of the popup layer, in dark mode the color value of this token will be a little brighter than `colorBgContainer`. E.g: modal, pop-up, menu, etc.string#ffffff
colorBorderDefault border color, used to separate different elements, such as: form separator, card separator, etc.string#d9d9d9
colorBorderDisabledControl the border color of the element in the disabled state.string#d9d9d9
colorErrorUsed to represent the visual elements of the operation failure, such as the error Button, error Result component, etc.string#ff4d4f
colorErrorAffixControl the color of form control prefix/suffix in error state.string#ff4d4f
colorErrorBgThe background color of the error state.string#fff2f0
colorErrorBgHoverThe hover state background color of the error state.string#fff1f0
colorErrorBorderHoverThe hover state border color of the error state.string#ffa39e
colorErrorTextThe default state of the text in the error color.string#ff4d4f
colorFillSecondaryThe second level of fill color can outline the shape of the element more clearly, such as Rate, Skeleton, etc. It can also be used as the Hover state of the third level of fill color, such as Table, etc.stringrgba(0,0,0,0.06)
colorFillTertiaryThe third level of fill color is used to outline the shape of the element, such as Slider, Segmented, etc. If there is no emphasis requirement, it is recommended to use the third level of fill color as the default fill color.stringrgba(0,0,0,0.04)
colorIconWeak action. Such as `allowClear` or Alert close buttonstringrgba(0,0,0,0.45)
colorIconHoverWeak action hover color. Such as `allowClear` or Alert close buttonstringrgba(0,0,0,0.88)
colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
colorPrimaryBorderThe stroke color under the main color gradient, used on the stroke of components such as Slider.string#91caff
colorSplitUsed as the color of separator, this color is the same as colorBorderSecondary but with transparency.stringrgba(5,5,5,0.06)
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorTextDisabledControl the color of text in disabled state.stringrgba(0,0,0,0.25)
colorTextHeadingControl the font color of heading.stringrgba(0,0,0,0.88)
colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
colorTextPlaceholderControl the color of placeholder text.stringrgba(0,0,0,0.25)
colorTextQuaternaryThe fourth level of text color is the lightest text color, such as form input prompt text, disabled color text, etc.stringrgba(0,0,0,0.25)
colorTextTertiaryThe third level of text color is generally used for descriptive text, such as form supplementary explanation text, list descriptive text, etc.stringrgba(0,0,0,0.45)
colorWarningUsed to represent the warning map token, such as Notification, Alert, etc. Alert or Control component(like Input) will use these map tokens.string#faad14
colorWarningAffixControl the color of form control prefix/suffix in warning state.string#faad14
colorWarningBgThe background color of the warning state.string#fffbe6
colorWarningBgHoverThe hover state background color of the warning state.string#fff1b8
colorWarningBorderHoverThe hover state border color of the warning state.string#ffd666
colorWarningTextThe default state of the text in the warning color.string#faad14
borderRadiusBorder radius of base componentsnumber6
borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
borderRadiusSMSM size border radius, used in small size components, such as Button, Input, Select and other input components in small sizenumber4
borderRadiusXSXS size border radius, used in some small border radius components, such as Segmented, Arrow and other components with small border radius.number2
boxShadowSecondaryControl the secondary box shadow style of an element.string 0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)
controlHeightThe height of the basic controls such as buttons and input boxes in Ant Designnumber32
controlHeightLGLG component heightnumber40
controlHeightSMSM component heightnumber24
controlItemBgActiveControl the background color of control component item when active.string#e6f4ff
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
fontSizeLGLarge font sizenumber16
fontSizeSMSmall font sizenumber12
fontWeightStrongControl the font weight of heading components (such as h1, h2, h3) or selected item.number600
lineHeightLine height of text.number1.5714285714285714
lineHeightLGLine height of large text.number1.5
lineTypeBorder style of base componentsstringsolid
lineWidthBorder width of base componentsnumber1
lineWidthBoldThe default line width of the outline class components, such as Button, Input, Select, etc.number2
lineWidthFocusControl the width of the line when the component is in focus state.number3
marginXSControl the margin of an element, with a small size.number8
marginXXSControl the margin of an element, with the smallest size.number4
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
motionEaseInOutCircPreset motion curve.string
Cubic Bezier Visualizer
cubic-bezier(0.78, 0.14, 0.15, 0.86)External Link Icon
motionEaseInQuintPreset motion curve.string
Cubic Bezier Visualizer
cubic-bezier(0.755, 0.05, 0.855, 0.06)External Link Icon
motionEaseOutCircPreset motion curve.string
Cubic Bezier Visualizer
cubic-bezier(0.08, 0.82, 0.17, 1)External Link Icon
motionEaseOutQuintPreset motion curve.string
Cubic Bezier Visualizer
cubic-bezier(0.23, 1, 0.32, 1)External Link Icon
paddingControl the padding of the element.number16
paddingSMControl the small padding of the element.number12
paddingXSControl the extra small padding of the element.number8
paddingXXSControl the extra extra small padding of the element.number4
sizePopupArrowThe size of the component arrownumber16

FAQ

When set mode to DatePicker/RangePicker, cannot select year or month anymore?

Please refer FAQ

Why does the date picker switch to the date panel after selecting the year instead of the month panel?

After selecting the year, the system directly switches to the date panel instead of month panel. This design is intended to reduce the user's operational burden by allowing them to complete the year modification with just one click, without having to enter the month selection interface again. At the same time, it also avoids additional cognitive burden of remembering the month.

How to use DatePicker with customize date library like dayjs?

Please refer Use custom date library

Why config dayjs.locale globally not work?

DatePicker default set locale as en in v4. You can config DatePicker locale prop or ConfigProvider locale prop instead.

Date-related components locale is not working?

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

How to modify start day of week?

Please use correct language (#5605), or update dayjs locale config:

  • Example: https://codesandbox.io/s/dayjs-day-of-week-x9tuj2?file=/demo.tsx
js
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.extend(updateLocale);
dayjs.updateLocale('zh-cn', {
weekStart: 0,
});

Why origin panel don't switch when using panelRender?

When you change the layout of nodes by panelRender, React will unmount and re-mount it which reset the component state. You should keep the layout stable. Please ref #27263 for more info.

How to understand disabled time and date?

Please refer to the blog 'Why is it so hard to disable the date?', to learn how to use it.

Basic

Basic use case. Users can select or input a date in a panel.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Multiple

Multiple selections. Does not support showTime and picker="time".

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.14.0
Switchable picker

Switch in different types of pickers by Select.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Choose Time

This property provides an additional time selection. When showTime is an Object, its properties will be passed on to the built-in TimePicker.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Limit Date Range

Limit the range of available dates by using minDate and maxDate.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.14.0
Disabled Date & Time

Disable specific dates and times by using disabledDate and disabledTime respectively, and disabledTime only works with showTime.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Select range dates

Using info.from of disabledDate to limit the dynamic date range selection.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Extra Footer

Render extra footer in panel for customized requirements.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Customized Cell Rendering

We can customize the rendering of the cells in the calendar by providing a cellRender function to DatePicker.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
External use panel

Custom menu, external selection panel.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Status

Add status to DatePicker with status, which could be error or warning.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom semantic dom styling

You can customize the semantic dom style of DatePicker by passing objects/functions through classNames and styles.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
6.0.0
Prefix and Suffix

Custom prefix and suffixIcon.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Range Picker

Set range picker type by picker prop.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Need Confirm

DatePicker will automatically determine whether to show a confirm button according to the picker property. You can also set the needConfirm property to determine whether to show a confirm button. When needConfirm is set, the user must click the confirm button to complete the selection. Otherwise, the selection will be submitted when the picker loses focus or selects a date.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.14.0
Date Format

We can set the date format by format. When format is an array, the input box can be entered in any of the valid formats of the array.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Mask Format

Align the date format. Switch the selection by arrow keys. Will try to align the date to the last valid date when blur.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.14.0
Disabled

A disabled state of the DatePicker. You can also set as array to disable one of input.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Allow Empty

Allow empty for the RangePicker. It's useful when you need to keep the "to date".

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Preset Ranges

We can set preset ranges to RangePicker to improve user experience. Since 5.8.0, preset value supports callback function.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Three Sizes

The input box comes in three sizes: small, medium and large. The medium size will be used if size is omitted.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Customize Panel

Replace panel with components.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.14.0
Buddhist Era

Use locale to support special calendar format.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.14.0
Variants

Variants of DatePicker, there are four variants: outlined filled borderless and underlined.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.13.0
Placement

You can manually specify the position of the popup via placement.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
+ 2 ...
+ 2 ...
+ 2 ...
Time
7 days range
6 months range
DatePicker
2026-06-25
RangePicker
2026-06-25 ~ 2026-06-26
ab
ab
ab
ab
Event Period
Event Period

By locale props

By ConfigProvider





  • root
    Root element with relative positioning, inline-flex layout, padding, border-radius, transition animations and other basic styles for date picker container
  • prefix
    Prefix element with flex layout and margin styles for prefix content layout
  • input
    Input element with relative positioning, width, color, font, line-height, transition animations and other core interactive styles for input field
  • suffix
    Suffix element with flex layout, color, line-height, pointer events, transition animations and other styles for suffix content
  • popup.root
    Popup element
  • popup.container
    Container element, set background color, padding, border radius, shadow, border and content display styles
  • popup.header
    Popup header element with navigation buttons, month/year selectors and other header control area layout and styles
  • popup.body
    Popup body element with container layout and styles for date panel table
  • popup.content
    Popup content element with width, border, cell and other content display styles for date table
  • popup.item
    Popup item element with size, background, border-radius, hover state, selected state and other interactive styles for date cells
  • popup.footer
    Popup footer element with layout styles for bottom operation area including confirm/cancel buttons and shortcuts