React Date Picker Component API
Date Picker API
Limited-time offer for the first 100 customers in 2025. Use code 2025SKY25 at checkout.
Explore the API reference for the React Date Picker component and discover how to effectively utilize its props for customization.
CDatePicker#
import { CDatePicker } from '@coreui/react-pro'// orimport CDatePicker from '@coreui/react-pro/src/components/date-picker/CDatePicker'
Property | Default | Type |
---|---|---|
ariaNavNextMonthLabel#5.5.0+ | 'Next month' | string |
A string that provides an accessible label for the button that navigates to the next month in the React Date Picker component. This label is read by screen readers to describe the action associated with the button. Customize for a more accessible calendar experience. | ||
ariaNavNextYearLabel#5.5.0+ | 'Next year' | string |
A string that provides an accessible label for the button that navigates to the next year in the React Date Picker component. Screen readers utilize this label to inform users of the button's functionality, aiding in a more inclusive application. | ||
ariaNavPrevMonthLabel#5.5.0+ | 'Previous month' | string |
A string that provides an accessible label for the button that navigates to the previous month in the React Date Picker component. This label is announced by screen readers, ensuring clarity around the button's purpose. | ||
ariaNavPrevYearLabel#5.5.0+ | 'Previous year' | string |
A string that provides an accessible label for the button that navigates to the previous year in the React Date Picker component. Use it to enhance the experience for screen readers and further accessibility. | ||
calendarDate# | - | string , Date |
Defines the initial date or reference date for the React Date Picker component. This date can be either a Date object or a string that can be converted into a valid date. | ||
cancelButton# | 'Cancel' | ReactNode |
Toggle visibility or set the content of cancel button. | ||
cancelButtonColor# | 'primary' | 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'dark' , 'light' , string |
Sets the color context of the cancel button to one of CoreUI’s themed colors. | ||
cancelButtonSize# | 'sm' | 'sm' , 'lg' |
Size the cancel button small or large. | ||
cancelButtonVariant# | 'ghost' | 'outline' , 'ghost' |
Set the cancel button variant to an outlined button or a ghost button. | ||
className# | - | string |
A string of all className you want applied to the component. | ||
cleaner# | - | boolean |
Toggle visibility or set the content of the cleaner button. | ||
closeOnSelect#4.8.0+ | - | boolean |
If true the dropdown will be immediately closed after submitting the full date. | ||
confirmButton# | 'OK' | ReactNode |
Toggle visibility or set the content of confirm button. | ||
confirmButtonColor# | 'primary' | 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'dark' , 'light' , string |
Sets the color context of the confirm button to one of CoreUI’s themed colors. | ||
confirmButtonSize# | 'sm' | 'sm' , 'lg' |
Size the confirm button small or large. | ||
confirmButtonVariant# | - | 'outline' , 'ghost' |
Set the confirm button variant to an outlined button or a ghost button. | ||
container# | - | 'dropdown' , 'inline' |
Set container type for the component. | ||
date# | - | string , Date |
Initial selected date. | ||
dayFormat#4.3.0+ | 'numeric' | 'numeric' , '2-digit' , ((date: Date) => string | number) |
Sets the format for day names. Accepts either a built-in format ('numeric' or '2-digit') or a custom function to return any desired string or number for the day. | ||
disabled# | - | boolean |
Toggle the disabled state for the component. | ||
disabledDates# | - | DisabledDate , DisabledDate[] |
Specifies one or more dates that cannot be selected by the user. This is useful for disabling weekends, holidays, or any dates that you need to restrict within your React Date Picker component. | ||
dropdownClassNames# | - | string |
A string of all className you want applied to the dropdown menu. | ||
feedback#4.2.0+ | - | ReactNode |
Provide valuable, actionable feedback. | ||
feedbackInvalid#4.2.0+ | - | ReactNode |
Provide valuable, actionable feedback. | ||
feedbackValid#4.2.0+ | - | ReactNode |
Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, | ||
firstDayOfWeek# | 1 | number |
Sets the first day of the week. This can be adjusted for different locales or preferences:
| ||
floatingClassName#4.5.0+ | - | string |
A string of all className you want applied to the floating label wrapper. | ||
footer# | - | boolean |
Toggle visibility of footer element. | ||
footerContent# | - | ReactNode |
Add custom elements to the footer. | ||
id# | - | string |
The id global attribute defines an identifier (ID) that must be unique in the whole document. [Deprecated since v5.3.0] The name attributes for input element is generated based on this property until you define name prop ex.:
| ||
indicator# | - | ReactNode |
Toggle visibility or set the content of the input indicator. | ||
inputDateFormat#5.0.0+ | - | (date: Date) => string |
Custom function to format the selected date into a string according to a custom format. | ||
inputDateParse#5.0.0+ | - | (date: string | Date) => Date |
Custom function to parse the input value into a valid Date object. | ||
inputOnChangeDelay#5.0.0+ | - | number |
Defines the delay (in milliseconds) for the input field's onChange event. | ||
inputReadOnly# | - | boolean |
Toggle the readonly state for the component. | ||
invalid# | - | boolean |
Set component validation state to invalid. | ||
label#4.2.0+ | - | ReactNode |
Add a caption for a component. | ||
locale# | 'default' | string |
Indicates the locale for the React Date Picker component. If not explicitly provided, it inherits the locale settings from the browser. | ||
maxDate# | - | string , Date |
The maximum date that can be selected. Any date beyond this value will be disabled within the calendar. This is often used to restrict future selections. | ||
minDate# | - | string , Date |
The minimum date that can be selected. Any date before this value will be disabled in the calendar. Useful for preventing selection of past dates or creating limited booking windows. | ||
name#5.3.0+ | - | string |
The name attribute for the input element. | ||
navigation# | - | boolean |
Toggles display of arrow-based navigation (previous/next controls) in the React Date Picker component. If set to | ||
navNextDoubleIcon# | - | ReactNode |
Customizes the icon for navigating multiple steps forward (double jump), e.g., skipping multiple months or years at once. Ideal for quick navigation through large date ranges. | ||
navNextIcon# | - | ReactNode |
Customizes the icon for navigating to the next view (month, year, etc.) depending on the current view. Accepts any valid | ||
navPrevDoubleIcon# | - | ReactNode |
Customizes the icon for a double jump backward (e.g., jumping multiple months or years at once). This feature simplifies larger date range navigation within your React Date Picker component. | ||
navPrevIcon# | - | ReactNode |
Customizes the icon for navigating to the previous view in the calendar. Accepts any valid ReactNode to provide flexible styling or theming. | ||
navYearFirst#4.3.0+ | false | boolean |
Reorders the year and month navigation, rendering the year selector first. This offers a different layout for users, particularly useful if you want to prioritize quick year changes. | ||
onDateChange# | - | (date: Date, formatedDate?: string) => void |
Callback fired when the date changed. | ||
onDateHover# | - | (date: string | Date) => void |
Callback fired when the user hovers over a calendar cell. The argument is the date of the cell that the user is currently hovering. | ||
onHide# | - | () => void |
Callback fired when the component requests to be hidden. | ||
onSelectEndChange# | - | (value: boolean) => void |
Callback fired when toggling between selecting the start date and the end date in range selection mode. Receives a boolean indicating if the user is currently selecting the end date. | ||
onShow# | - | () => void |
Callback fired when the component requests to be shown. | ||
onViewChanged# | - | (view: string) => void |
Callback fired when the calendar's view changes between days, months, or years. For instance, moving from day view to month view or from month view to year view. | ||
placeholder# | Select date | string , string[] |
Specifies short hints that are visible in start date and end date inputs. | ||
portal#5.9.0+ | - | boolean |
Generates dropdown menu using createPortal. | ||
rangesButtonsColor# | - | 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'dark' , 'light' , string |
Sets the color context of the cancel button to one of CoreUI’s themed colors. | ||
rangesButtonsSize# | - | 'sm' , 'lg' |
Size the ranges button small or large. | ||
rangesButtonsVariant# | - | 'outline' , 'ghost' |
Set the ranges button variant to an outlined button or a ghost button. | ||
required#4.10.0+ | - | boolean |
When present, it specifies that date must be filled out before submitting the form. | ||
selectAdjacementDays#4.11.0+ | false | boolean |
Sets whether days from adjacent months (shown at the start/end of the current view) are selectable. This only applies if | ||
selectionType#5.0.0+ | 'day' | SelectionTypes |
Specifies the selection type for the React Date Picker component. Supports:
| ||
separator# | - | ReactNode |
Default icon or character character that separates two dates. | ||
showAdjacementDays#4.11.0+ | true | boolean |
Controls whether the calendar should display dates from previous or next months (non-selectable if | ||
showWeekNumber#5.0.0+ | false | boolean |
Toggles the display of week numbers (ISO 8601) in the calendar's left column. Particularly beneficial for applications where users need to see the week index for scheduling or reporting. | ||
size# | - | 'sm' , 'lg' |
Size the component small or large. | ||
text#4.2.0+ | - | ReactNode |
Add helper text to the component. | ||
timepicker# | - | boolean |
Provide an additional time selection by adding select boxes to choose times. | ||
todayButton# | 'Today' | ReactNode |
Toggle visibility or set the content of today button. | ||
todayButtonColor# | 'primary' | 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'dark' , 'light' , string |
Sets the color context of the today button to one of CoreUI’s themed colors. | ||
todayButtonSize# | 'sm' | 'sm' , 'lg' |
Size the today button small or large. | ||
todayButtonVariant# | - | 'outline' , 'ghost' |
Set the today button variant to an outlined button or a ghost button. | ||
toggler# | - | ReactNode |
The content of toggler. | ||
tooltipFeedback#4.2.0+ | - | boolean |
Display validation feedback in a styled tooltip. | ||
valid# | - | boolean |
Set component validation state to valid. | ||
visible# | - | boolean |
Toggle the visibility of dropdown menu component. | ||
weekdayFormat# | 2 | number , 'long' , 'narrow' , 'short' , ((date: Date) => string | number) |
Sets the format or length of the weekday names displayed in the calendar header. You can use numeric values like 2 (two-letter abbreviations) or built-in string formats like | ||
weekNumbersLabel#5.0.0+ | - | string |
Defines the label that appears above the week numbers column. For example, you might label it |