React Date Range Picker Component API
Date Range 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 Range Picker component and discover how to effectively utilize its props for customization.
CDateRangePicker#
import { CDateRangePicker } from '@coreui/react-pro'// orimport CDateRangePicker from '@coreui/react-pro/src/components/date-range-picker/CDateRangePicker'
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 Range 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 Range 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 Range 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 Range 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 Range Picker component. This date can be either a Date object or a string that can be converted into a valid date. | ||
calendars# | 2 | number |
The number of calendars that render on desktop devices. | ||
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# | true | boolean |
Toggle visibility or set the content of the cleaner button. | ||
closeOnSelect#4.8.0+ | true | 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. | ||
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 Range Picker component. | ||
dropdownClassNames# | - | string |
A string of all className you want applied to the dropdown menu. | ||
endDate# | - | string , Date |
Defines the initially selected ending date (applicable when using range selection). Accepts both Date objects and valid date strings. | ||
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 , [string, string] |
The id attribute for the input elements. It can be a single string for both the start and end dates. If a single string is used, the postfix "-start-date" and "-end-date" will be automatically added to make the IDs unique. Alternatively, you can use an array of two strings for start and end dates separately. [Deprecated since v5.3.0] If the property is a type of string, the name attributes for input elements are generated based on this property until you define name prop ex.:
| ||
indicator# | true | 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+ | 750 | 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 Range 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 , [string, string] |
The name attribute for the input elements. It can be a single string for both the start and end dates. If a single string is used, the postfix "-start-date" and "-end-date" will be automatically added to make the names unique. Alternatively, you can use an array of two strings for start and end dates separately. Example for single string: 'date-input' Example for array: ['start-date-input', 'end-date-input'] | ||
navigation# | - | boolean |
Toggles display of arrow-based navigation (previous/next controls) in the React Date Range 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 Range 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. | ||
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. | ||
onEndDateChange# | - | (date: string | Date, formatedDate?: string) => void |
Callback triggered when the end date of the selection changes. Handy for synchronizing the selected date range with external states or components. | ||
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. | ||
onStartDateChange# | - | (date: string | Date, formatedDate?: string) => void |
Callback triggered when the start date of the selection changes. Useful for updating other parts of your application or performing side effects based on the newly chosen start date. | ||
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# | ['Start date', 'End date'] | string , string[] |
Specifies short hints that are visible in start date and end date inputs. | ||
portal#5.9.0+ | true | boolean |
Generates dropdown menu using createPortal. | ||
ranges# | - | object |
Predefined date ranges the user can select from. | ||
rangesButtonsColor# | secondary | '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# | ghost | '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 | ||
selectEndDate# | - | boolean |
Indicates if the user's current selection is targeting the end date in range selection mode. Primarily used for controlled components where you need to manage which date (start or end) is currently active. | ||
selectionType#5.0.0+ | day | SelectionTypes |
Specifies the selection type for the React Date Range Picker component. Supports:
| ||
separator# | true | 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. | ||
startDate# | - | string , Date |
Defines the initially selected starting date. This date can be a Date object or a string convertible into a valid date. Useful when you want to show a pre-selected date. | ||
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 |