datepicker (component)

January 21, 2025 ยท View on GitHub

General datepicker component.

nametypedefault valuedescription
allowSameDayboolfalse
ariaDescribedBystringnull
ariaInvalidstringnull
ariaLabelledBystringnull
ariaRequiredstringnull
autoCompletestring
autoFocusbool
calendarClassNamestring
childrennode
classNamestring
clearButtonTitlestring
clearButtonClassNamestringCustomize the clear button
customInputelement
customInputRefstring'ref'The property used to pass the ref callback
dateFormatunion(string|array)'MM/dd/yyyy'
dateFormatCalendarstring'LLLL yyyy'
dayClassNamefunc
weekDayClassNamefunc
yearClassNamefunc
disabledboolfalse
disabledKeyboardNavigationboolfalse
dropdownMode (required)enum('scroll'|'select')'scroll'
endDateinstanceOf(Date)
excludeDatesarray
excludeDateIntervalsarray
excludeTimesarray
excludeScrollbararray
filterDatefunc
filterTimefunc
fixedHeightbool
focusSelectedMonthboolfalse
forceShowMonthNavigationbool
formatWeekNumberfunc
highlightDatesarray
holidaysarrayThe list of holidays. An array consisting of date(yyyy-mm-dd) and holidayName, For example: holidays={[{date: '2023-08-15',holidayName:"Holiday 1"},{date: '2023-12-31',holidayName:"Holiday 2"}]}. If multiple unique holiday names are provided for same date, it will display both in comma separated string.
idstring
includeDatesarray
includeDateIntervalsarray
includeTimesarray
injectTimesarray
inlinebool
isClearablebool
localestring
maxDateinstanceOf(Date)
maxTimeinstanceOf(Date)
minDateinstanceOf(Date)
minTimeinstanceOf(Date)
monthsShownnumber1
namestring
onBlurfuncfunction() {}
onCalendarClosefunc
onCalendarOpenfunc
onChange (required)funcfunction() {}
onChangeRawfunc
onClickOutsidefuncfunction() {}
onFocusfuncfunction() {}
onKeyDownfuncfunction() {}
onMonthChangefuncfunction() {}
onSelectfuncfunction() {}
onWeekSelectfunc
onYearChangefuncfunction() {}
openToDateinstanceOf(Date)
peekNextMonthbool
placeholderTextstring
popperClassNamestring
popperContainerfunc
popperModifiersobject
popperPlacementenumpopperPlacementPositions
preventOpenOnFocusboolfalseWhen this is true, the datepicker will not automatically open when the date field is focused
readOnlybool
requiredbool
scrollableYearDropdownbool
selectedinstanceOf(Date)
selectsEndbool
selectsStartbool
shouldCloseOnSelectbooltrue
showMonthDropdownbool
showTimeSelectboolfalse
showWeekNumbersbool
showYearDropdownbool
startDateinstanceOf(Date)
startOpenbool
tabIndexnumber
timeClassNamefunc
timeFormatstring
timeIntervalsnumber30
titlestring
todayButtonnode
useWeekdaysShortbool
utcOffsetunion(number|string)
valuestring
weekLabelstring
withPortalboolfalse
portalIdstring
portalHostinstanceOf(ShadowRoot)When set, portals will be attached to this ShadowRoot instead of the document body.
wrapperClassNamestring
yearItemNumbernumber12
yearDropdownItemNumbernumber
iconstring or elementAllows using a custom calendar icon. Accepts a string (icon class name) or a React component (e.g., custom SVG). If a string is passed, an <i> element is rendered with that string as its class name. If a React component is passed, it is rendered as-is.
calendarIconClassnamestringthis props is deprecated. should use calendarIconClassName props.
calendarIconClassNamestringAccepts a string that will be added as an additional CSS class to the calendar icon, allowing further styling customization.
showIconbooltrueDetermines whether the calendar icon is displayed. Set to true to display the icon, and false to hide it. If icon prop is also provided, the custom icon will be displayed when showIcon is true.
usePointerEventboolfalseTrue if Pointer Events (e.g, onPointerEnter, onPointerLeave) are used internally instead of Mouse Events (e.g, onMouseEnter, onMouseLeave).