DatePicker

Date picker allow users select a date by from a popup calendar.

Basic

Typical usage DatePicker component.

Range picker

Typical usage RangePicker component.

Date time picker

Combination of <DatePicker /> & <TimeInput />

Controlled

Controlled usage with <DatePicker /> & <DatePickerRange />

Format

Picker allow us to set custom both date format for input & picker via inputFormat & labelFormat props.

Custom Render

You can render custom day elements or apply styles & className to days with these dayStyle, dayClassName & renderDay props.

Disable out of period date

Setting minDate & maxDate props to limit available date within a period.

Disabled certain date

Disabled part of dates by using disabledDate prop callback.

Multiple date view

We can have mutiple date view by setting dateViewCount more than 1.

Disabled Input

Use disabled prop to disable user expand DatePicker.

Inputtable

Release input lock to let user enter the date manually.

Input Size

DatePicker allow us to control the input size via size prop.

Input Affix

inputSuffix or inputPrefix allow us to customize input affix content.

Clear Button

You can customize the clear button via clearable or clearButton props.

Localization

DatePicker receive locale value from <ConfigProvider />, but there is also an option to input locale manually.

API

DatePicker
PropDescriptionTypeDefault
clearableWhether allow to clear valuebooleantrue
clearButtonCustom clear buttonstring | ReactNodeReactNode
closePickerOnChangeWhether close picker upon date selectedbooleantrue
dateViewCountAmount of date view display in pickernumber1
dayClassNameApply className to days based on argument(date: Date, modifiers: {disabled: boolean, weekend: boolean, selectedInRange: boolean, selected: boolean, inRange: boolean, firstInRange: boolean, lastInRange: boolean, outOfMonth: boolean}) => string-
dayStyleApply style to days based on argument(date: Date, modifiers: {disabled: boolean, weekend: boolean, selectedInRange: boolean, selected: boolean, inRange: boolean, firstInRange: boolean, lastInRange: boolean, outOfMonth: boolean}) => CSSProperties-
defaultValueDefault value of DatePicker (use value instead if it is controlled)Date-
defaultMonthDefault month for uncontrolled DatePickerDate-
defaultOpenWhether to default open DatePickerbooleanfalse
defaultViewDefault DatePicker view'date' | 'month' | 'year' 'date'
disabledDetermine whether DatePicker Input is disabledbooleanfalse
disabledDateSpecify the date that cannot be selected(date: Date) => boolean-
disableOutOfMonthWhether to disable days that out of given monthbooleanfalse
enableHeaderLabelEnable header label to trigger view changebooleantrue
firstDayOfWeekFirst day of week'sunday' | 'monday''monday'
hideOutOfMonthDatesWhether to hide days that out of given monthbooleanfalse
hideWeekdaysWhether to hide week daysbooleanfalse
inputFormatDatePicker Input display formatstring'YYYY-MM-DD'
inputPrefixRender a prefix content inside DatePicker Inputstring | ReactNode-
inputSuffixRender a suffix content inside DatePicker Inputstring | ReactNode-
inputtableWhether to allow input typingbooleanfalse
labelFormatWhether to allow input typing{month: string, year: string}{month: 'MMM', year: 'YYYY'}
localeDatePicker localedayjs localeen
maxDateMaximum date to selectDate-
minDateMinimum date to selectDate-
monthLabelFormatMonth label formatstring'YYYY'
onBlurCallback when DatePicker Input blur-smfunction(event: Event) -
onChangeCallback when date cell is selectedfunction(date: Date) -
onDayMouseEnterCallback when date is hoveredfunction(date: Date) -
onFocusCallback when DatePicker Input focusfunction(event: Event) -
onDropdownCloseCallback when DatePicker close() => void -
onDropdownOpenCallback when DatePicker open() => void -
openPickerOnClearWhether to open DatePicker upon clear valuebooleanfalse
rangeHighlight given date range[Date | null, Date | null]-
renderDayRender custome day element based on the given params(date: Date) => ReactNodefalse
sizeDatePicker input size'sm' | 'md' | 'lg' 'md'
valueValue of DatePicker (Controlled)Date-
weekdayLabelFormatFormat for weekday displaystring'dd'
weekendDaysIndicate the days of weekendnumber[][0, 6]
yearLabelFormatYear label formatstring'YYYY'
DatePicker.DatePickerRange
PropDescriptionTypeDefault
clearableWhether allow to clear valuebooleantrue
clearButtonCustom clear buttonstring | ReactNodeReactNode
closePickerOnChangeWhether close picker upon date selectedbooleantrue
dateViewCountAmount of date view display in pickernumber1
dayClassNameApply className to days based on argument(date: Date, modifiers: {disabled: boolean, weekend: boolean, selectedInRange: boolean, selected: boolean, inRange: boolean, firstInRange: boolean, lastInRange: boolean, outOfMonth: boolean}) => string-
dayStyleApply style to days based on argument(date: Date, modifiers: {disabled: boolean, weekend: boolean, selectedInRange: boolean, selected: boolean, inRange: boolean, firstInRange: boolean, lastInRange: boolean, outOfMonth: boolean}) => CSSProperties-
defaultValueDefault value of DatePickerRange (use value instead if it is controlled)Date-
defaultMonthDefault month for uncontrolled DatePickerRangeDate-
defaultOpenWhether to default open DatePickerRangebooleanfalse
defaultViewDefault DatePickerRange view'date' | 'month' | 'year' 'date'
disabledDetermine whether DatePickerRange Input is disabledbooleanfalse
disabledDateSpecify the date that cannot be selected(date: Date) => boolean-
disableOutOfMonthWhether to disable days that out of given monthbooleanfalse
enableHeaderLabelWhether to disable header label to trigger view changebooleantrue
firstDayOfWeekFirst day of week'sunday' | 'monday''monday'
hideOutOfMonthDatesWhether to hide days that out of given monthbooleanfalse
hideWeekdaysWhether to hide week daysbooleanfalse
inputFormatDatePickerRange Input display formatstring'YYYY-MM-DD'
inputPrefixRender a prefix content inside DatePickerRange Inputstring | ReactNode-
inputSuffixRender a suffix content inside DatePickerRange Inputstring | ReactNode-
inputtableWhether to allow input typingbooleanfalse
inputtableBlurCloseWhether to close DatePicker upon input (only work when inputtable is true)booleantrue
labelFormatSeperator between date display on inputstring'~'
localeDatePickerRange localedayjs localeen
maxDateMaximum date to selectDate-
minDateMinimum date to selectDate-
monthLabelFormatMonth label formatstring'YYYY'
onChangeCallback when date cell is selectedfunction(date: Date) -
onDayMouseEnterCallback when date is hoveredfunction(date: Date) -
onDropdownCloseCallback when DatePickerRange close() => void -
onDropdownOpenCallback when DatePickerRange open() => void -
openPickerOnClearWhether to open DatePickerRange upon clear valuebooleanfalse
rangeHighlight given date range[Date | null, Date | null]-
renderDayRender custome day element based on the given params(date: Date) => ReactNodefalse
separatorSeperator between datesstring'~'
sizeDatePickerRange input size'sm' | 'md' | 'lg' 'md'
singleDateOnly one date can be selectedboolean false
valueValue of DatePickerRange (Controlled)[Date | null, Date | null]-
weekdayLabelFormatFormat for weekday displaystring'dd'
weekendDaysIndicate the days of weekendnumber[][0, 6]
yearLabelFormatYear label formatstring'YYYY'
DatePicker.DateTimepicker
PropDescriptionTypeDefault
amPmWhether to set time input to 12 hours formatbooleantrue
clearableWhether allow to clear valuebooleantrue
clearButtonCustom clear buttonstring | ReactNodeReactNode
closePickerOnChangeWhether close picker upon date selectedbooleanfalse
dateViewCountAmount of date view display in pickernumber1
dayClassNameApply className to days based on argument(date: Date, modifiers: {disabled: boolean, weekend: boolean, selectedInRange: boolean, selected: boolean, inRange: boolean, firstInRange: boolean, lastInRange: boolean, outOfMonth: boolean}) => string-
dayStyleApply style to days based on argument(date: Date, modifiers: {disabled: boolean, weekend: boolean, selectedInRange: boolean, selected: boolean, inRange: boolean, firstInRange: boolean, lastInRange: boolean, outOfMonth: boolean}) => CSSProperties-
defaultValueDefault value of DateTimepicker (use value instead if it is controlled)Date-
defaultMonthDefault month for uncontrolled DateTimepickerDate-
defaultOpenWhether to default open DateTimepickerbooleanfalse
defaultViewDefault DateTimepicker view'date' | 'month' | 'year' 'date'
disabledDetermine whether DateTimepicker Input is disabledbooleanfalse
disabledDateSpecify the date that cannot be selected(date: Date) => boolean-
disableOutOfMonthWhether to disable days that out of given monthbooleanfalse
enableHeaderLabelWhether to disable header label to trigger view changebooleantrue
firstDayOfWeekFirst day of week'sunday' | 'monday''monday'
hideOutOfMonthDatesWhether to hide days that out of given monthbooleanfalse
hideWeekdaysWhether to hide week daysbooleanfalse
inputFormatDateTimepicker Input display formatstring'YYYY-MM-DD'
inputPrefixRender a prefix content inside DateTimepicker Inputstring | ReactNode-
inputSuffixRender a suffix content inside DateTimepicker Inputstring | ReactNode-
labelFormatWhether to allow input typing{month: string, year: string}{month: 'MMM', year: 'YYYY'}
localeDateTimepicker localedayjs localeen
maxDateMaximum date to selectDate-
minDateMinimum date to selectDate-
monthLabelFormatMonth label formatstring'YYYY'
okButtonContentOk button contentstring | ReactNode'ok'
onBlurCallback when DateTimepicker Input blur-smfunction(event: Event) -
onChangeCallback when date cell is selectedfunction(date: Date) -
onDayMouseEnterCallback when date is hoveredfunction(date: Date) -
onFocusCallback when DateTimepicker Input focusfunction(event: Event) -
onDropdownCloseCallback when DateTimepicker close() => void -
onDropdownOpenCallback when DateTimepicker open() => void -
openPickerOnClearWhether to open DateTimepicker upon clear valuebooleanfalse
rangeHighlight given date range[Date | null, Date | null]-
renderDayRender custome day element based on the given params(date: Date) => ReactNodefalse
sizeDateTimepicker input size'sm' | 'md' | 'lg' 'md'
valueValue of DateTimepicker (Controlled)Date-
weekdayLabelFormatFormat for weekday displaystring'dd'
weekendDaysIndicate the days of weekendnumber[][0, 6]
yearLabelFormatYear label formatstring'YYYY'