React Date Range Picker Component API

Date Range Picker API

Explore the API reference for the React Date Range Picker component and discover how to effectively utilize its props for customization.

On this page

CDateRangePicker

jsx
import { CDateRangePicker } from '@coreui/react-pro'
PropertyDefaultType
ariaCleanerLabelClear date rangestring

Sets the accessible label (aria-label) of the button that clears the value.

ariaDayLabel'Day'string

The aria-label of the day section.

ariaEndLabel6.0.0+End datestring

The accessible name of the end field, used when it has no floating label.

ariaHourLabel'Hour'string

The aria-label of the hour section.

ariaMeridiemLabel'AM/PM'string

The aria-label of the meridiem section.

ariaMinuteLabel'Minute'string

The aria-label of the minute section.

ariaMonthLabel'Month'string

The aria-label of the month section.

ariaNavNextMonthLabel5.5.0+'Next month'string

A string that provides an accessible label for the button that navigates to the next month in the React Calendar component. This label is read by screen readers to describe the action associated with the button. Customize for a more accessible calendar experience.

ariaNavNextYearLabel5.5.0+'Next year'string

A string that provides an accessible label for the button that navigates to the next year in the React Calendar component. Screen readers utilize this label to inform users of the button's functionality, aiding in a more inclusive application.

ariaNavNextYearsLabel6.0.0+'Next 12 years'string

Sets the accessible label (aria-label) of the button that turns the years view to the next page of years.

ariaNavPrevMonthLabel5.5.0+'Previous month'string

A string that provides an accessible label for the button that navigates to the previous month in the React Calendar component. This label is announced by screen readers, ensuring clarity around the button's purpose.

ariaNavPrevYearLabel5.5.0+'Previous year'string

A string that provides an accessible label for the button that navigates to the previous year in the React Calendar component. Use it to enhance the experience for screen readers and further accessibility.

ariaNavPrevYearsLabel6.0.0+'Previous 12 years'string

Sets the accessible label (aria-label) of the button that turns the years view to the previous page of years.

ariaNothingToPickLabel6.0.0+'Nothing on this page can be picked'string

Sets the description (aria-describedby) of a grid in which nothing can be picked, such as a page wholly outside minDate / maxDate or one that disabledDates covers, also announced when the calendar turns to such a page. An empty string leaves the grid without a description.

ariaPickerLabel6.0.0+Toggle calendarstring

Sets the accessible label (aria-label) of the button that opens the calendar, followed by the range the picker holds.

ariaPopupLabel6.0.0+Calendarstring

Sets the accessible label (aria-label) of the calendar panel, which opens as a role="dialog".

ariaQuarterLabel'Quarter'string

The aria-label of the quarter section.

ariaSecondLabel'Second'string

The aria-label of the second section.

ariaSelectedDateAnnouncement6.0.0+'Selected date: {date}'string

Sets the message announced when a pick leaves both ends on the same day, unless the pick closes the panel, which names the toggle with the range instead. {date} is replaced by the full name of that day, week, month, quarter or year. An empty string announces nothing.

ariaSelectedRangeAnnouncement6.0.0+'Selected range: {start} to {end}'string

Sets the message announced when a pick leaves both ends set, unless the pick closes the panel, which names the toggle with the range instead. {start} and {end} are replaced by the full names of its ends. An empty string announces nothing.

ariaStartLabel6.0.0+Start datestring

The accessible name of the start field, used when it has no floating label.

ariaWeekLabel'Week'string

The aria-label of the week section.

ariaWeekNumberLabel6.0.0+-((weekNumber: number) => string | undefined)

Names each week number for screen readers: a function that takes the week number and returns its name. Without it the name is the locale's word for week and the number, such as Week 36. Keep the number in the name, so a voice-control user can say what they see.

ariaYearLabel'Year'string

The aria-label of the year section.

calendarDate-string, Date, null

Defines the initial date or reference date for the calendar. This date can be either a Date object or a string that can be converted into a valid date. Without it, the calendar opens on the picker's start date, else its end date.

calendars2number

Specifies how many individual calendars should be displayed side by side on desktop devices. Increasing this number allows your users to view multiple months (or years, etc.) simultaneously.

className-string

Adds a custom class name to the React Date Range Picker.

cleanertrueboolean

Renders the button that clears the value.

cleanerIcon-ReactNode

The artwork of the cleaner button. Defaults to a cross drawn on currentColor.

container-Element, DocumentFragment, (() => Element | DocumentFragment | null), null

The element the calendar is rendered into instead of document.body. Implies portal. Inside a modal dialog it goes into the dialog instead, because the rest of the page is inert.

dayFormat4.3.0+'numeric''numeric', '2-digit', ((date: Date) => string | number)

Sets the format for days. Accepts either a built-in format ('numeric' or '2-digit') or a custom function to return any desired string or number for the day.

dayPlaceholder-string

Replaces the DD the day section shows while it is empty.

defaultEndDate-string, Date, null

The initial end of the range for the uncontrolled mode. Ignored when endDate is set.

defaultShow6.0.0+-boolean

The initial open state of an uncontrolled calendar — read once on mount.

defaultStartDate-string, Date, null

The initial start of the range for the uncontrolled mode. Ignored when startDate is set.

disabled-boolean

Toggles the disabled state.

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 Calendar component. In week, month, quarter and year selection a period is disabled when every day of it is.

endDate-string, Date, null

The controlled end of the range. Pair it with onEndDateChange; for the uncontrolled mode use defaultEndDate instead.

endName-string

Name of the end value input. Without it the end date is not submitted with the form.

feedback4.2.0+-ReactNode

Feedback for the current validationState — rendered only while the state is set, and styled after it. For the client-side mode, where the browser owns the state, use feedbackValid and feedbackInvalid instead.

feedbackInvalid4.2.0+-ReactNode

Feedback the stylesheet reveals while the control is invalid — always rendered, so it works with client-side validation, where the browser decides the state.

feedbackValid4.2.0+-ReactNode

Feedback the stylesheet reveals while the control is valid — always rendered, so it works with client-side validation, where the browser decides the state.

firstDayOfWeek1number

Sets the first day of the week. This can be adjusted for different locales or preferences: - 0 = Sunday - 1 = Monday - 2 = Tuesday - 3 = Wednesday - 4 = Thursday - 5 = Friday - 6 = Saturday

floatingLabelAlways6.0.0+-boolean

Keeps the floating label floated and the placeholder visible while the field is empty.

floatingLabels6.0.0+-string[]

Renders a floating label over each field — ['Check-in', 'Check-out'] — which also becomes that field's accessible name.

The content of the calendar's footer. Either a node, or a function receiving the picker's context — setRange, clear, reset, close, isDateSelectable, startDate, endDate and disabled.

format-string, ((locale: string) => DateSection[])

The mask layout. A string is parsed as dayjs/moment or date-fns/luxon format tokens, a function receives the locale and returns the section layout, and undefined derives the layout from the locale.

hourPlaceholder-string

Replaces the HH (hh on a 12-hour clock) the hour section shows while it is empty.

inputDateParse-((value: string) => Date | null)

Custom function to parse text pasted into the field into a Date object, e.g. with an external date library.

invalidDeprecated 6.0.0-boolean

Mark the control invalid.

Use validationState="invalid" instead — invalid is ignored when validationState is set.

label4.2.0+-ReactNode

Add a caption for a component.

localenavigator.languagestring

Indicates the locale for the React Calendar component. If not explicitly provided, it inherits the locale settings from the browser.

maxDate-string, Date, null

The maximum date that can be selected. The days after its day are disabled within the calendar, and a time of day it carries leaves its own day selectable. In week selection its whole week stays selectable. This is often used to restrict future selections.

meridiemPlaceholder-string

Replaces the AM the meridiem section shows while it is empty.

minDate-string, Date, null

The minimum date that can be selected. The days before its day are disabled in the calendar, and a time of day it carries leaves its own day selectable. In week selection its whole week stays selectable. Useful for preventing selection of past dates or creating limited booking windows.

minutePlaceholder-string

Replaces the mm the minute section shows while it is empty.

monthFormat5.24.0+'short''numeric', '2-digit', 'long', 'narrow', 'short'

Sets the format for month names. Accepts built-in formats ('long', 'narrow', 'short', 'numeric', '2-digit').

monthNames-string[]

Twelve custom month names for text month sections (MMM/MMMM), overriding the locale-derived, date-context grammatical form.

monthPlaceholder-string

Replaces the MM the month section shows while it is empty.

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. In right-to-left it shows on the double previous button.

navNextIcon-ReactNode

Customizes the icon for navigating to the next view (month, year, etc.) depending on the current view. Accepts any valid ReactNode, enabling you to display text, images, or icons. In right-to-left it shows on the previous button.

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 Calendar component. In right-to-left it shows on the double next button.

navPrevIcon-ReactNode

Customizes the icon for navigating to the previous view in the calendar. Accepts any valid ReactNode to provide flexible styling or theming. In right-to-left it shows on the next button.

onCalendarDateChange-((date: string | Date, view: 'days' | 'months' | 'quarters' | 'years') => void)

Callback fired when the calendar's reference date (i.e., the date indicating which month/year is currently displayed) changes. Receives the new Date | string as an argument for further handling.

onEndDateChange-((date: Date | null, formattedDate?: string | undefined) => void)

Callback fired once when the end of the range changes, whether from its field, the calendar or the context methods; receives the Date the field holds (or null while it is empty, incomplete or out of range) and the formatted value.

onError-((error: DateInputError) => void)

Callback fired when the validation state changes; receives 'incomplete', 'minDate', 'maxDate', 'disabledDate', or null when the value is valid or the field is empty. When one change moves both the value and the validation state, it fires after the change callback, so a value set from it replaces the one just reported.

onHide-(() => void)

Callback fired when the calendar is hidden.

onShow-(() => void)

Callback fired when the calendar is shown.

onShowChange6.0.0+-((show: boolean) => void)

Callback fired when the calendar requests an open-state change — a dismiss gesture (Escape, a click outside) or, in uncontrolled mode, any internal toggle. In controlled mode update show yourself, or the calendar stays as it is.

onStartDateChange-((date: Date | null, formattedDate?: string | undefined) => void)

Callback fired once when the start of the range changes, whether from its field, the calendar or the context methods; receives the Date the field holds (or null while it is empty, incomplete or out of range) and the formatted value.

onValidationStateChange6.0.0+-((validationState: ValidationState | undefined) => void)

Callback fired with undefined when the user changes either end, or the form is reset, while validationState (or the deprecated invalid/valid) is set. A given state is a verdict on the range it was given for; clear it here to let the browser's own validation show again.

onViewChange6.0.0+-((view: string) => void)

Callback fired when the view changes, and with the view selectionType starts in each time the calendar mounts or selectionType changes.

onViewChangedDeprecated 6.0.0-((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.

Use onViewChange instead — both fire while onViewChanged is set.

pickerIcontrueReactNode

The artwork of the button that opens the calendar. Defaults to a calendar drawn on currentColor.

portaltrueboolean

Renders the calendar through a portal: into the open <dialog> the field sits in, otherwise into document.body.

quarterPlaceholder-string

Replaces the Q the quarter section shows while it is empty.

ranges-ReactNode, ((context: CDateRangePickerContextValue) => ReactNode)

The content of the panel's ranges region, beside the calendars. Either a node, or a function receiving the picker's context — a preset button calls setRange with its own dates.

readOnly-boolean

Toggle the readonly state for the component.

renderDayCell5.24.0+-((date: Date, meta: { isDisabled: boolean; isInCurrentMonth: boolean; isInRange: boolean; isSelected: boolean; isToday: boolean; label: string; }) => ReactNode)

A function that allows you to customize the rendering of individual day cells within the calendar. This function receives the date and metadata (like selection and disabled status) as arguments, enabling you to apply custom styles, add tooltips, or include additional content in each day cell. The metadata carries the cell's full name as label, for example for visually hidden text next to a short label.

renderMonthCell5.24.0+-((date: Date, meta: { isDisabled: boolean; isInRange: boolean; isSelected: boolean; label: string; }) => ReactNode)

A function that allows you to customize the rendering of individual month cells within the calendar. This function receives the date and metadata (like selection and disabled status) as arguments, enabling you to apply custom styles or include additional content in each month cell. The metadata carries the cell's full name as label, for example for visually hidden text next to a short label.

renderQuarterCell5.24.0+-((date: Date, meta: { isDisabled: boolean; isInRange: boolean; isSelected: boolean; label: string; }) => ReactNode)

A function that allows you to customize the rendering of individual quarter cells within the calendar. This function receives the date and metadata (like selection and disabled status) as arguments, enabling you to apply custom styles or include additional content in each quarter cell. The metadata carries the cell's full name as label, for example for visually hidden text next to a short label.

renderYearCell5.24.0+-((date: Date, meta: { isDisabled: boolean; isInRange: boolean; isSelected: boolean; label: string; }) => ReactNode)

A function that allows you to customize the rendering of individual year cells within the calendar. This function receives the date and metadata (like selection and disabled status) as arguments, enabling you to apply custom styles or include additional content in each year cell. The metadata carries the cell's full name as label, for example for visually hidden text next to a short label.

required-boolean

When present, it specifies that the field must be filled out before submitting the form.

secondPlaceholder-string

Replaces the ss the second section shows while it is empty.

selectAdjacentDays4.11.0+falseboolean

Sets whether days from adjacent months (shown at the start/end of the current view) are selectable. This only applies if showAdjacentDays is set to true. A picked day of an adjacent month keeps the month on screen and shows as selected with an outline on a subtle background instead of the solid fill.

selectionType5.0.0+daySelectionTypes

Specifies the selection type for the React Calendar component. Supports: - day: Regular day selection (default) - week: Select an entire week - month: Select an entire month - quarter: Select an entire quarter - year: Select an entire year

separatorIcon-ReactNode

The artwork between the two fields. Defaults to an arrow drawn on currentColor, mirrored in right-to-left contexts.

show6.0.0+-boolean

Control the open state. When set, the calendar renders what show says and dismiss gestures only call onShowChange — nothing closes until the parent flips the prop.

showAdjacentDays4.11.0+trueboolean

Controls whether the calendar should display dates from previous or next months (non-selectable if selectAdjacentDays is false). This can make the calendar visually continuous.

showWeekNumber5.0.0+falseboolean

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'

Sizes the control, the way .form-control-sm and .form-control-lg size a form control.

startDate-string, Date, null

The controlled start of the range. Pair it with onStartDateChange; for the uncontrolled mode use defaultStartDate instead.

startName-string

Name of the start value input. Without it the start date is not submitted with the form.

text4.2.0+-ReactNode

Add helper text to the component.

tooltipFeedback4.2.0+-boolean

Display validation feedback in a styled tooltip.

validDeprecated 6.0.0-boolean

Mark the control valid.

Use validationState="valid" instead — valid is ignored when validationState is set.

validationState6.0.0+-'valid', 'invalid', string

The validation state, rendered as the is-{state} class; 'invalid' also sets aria-invalid on every section and blocks the submit. Any custom state declared in the $form-validation-states Sass map is accepted. A field of a date range whose end is before its start draws no other state. The user's next change of the value asks to drop it through onValidationStateChange.

visibleDeprecated 6.0.0-boolean

Controls the visibility of the calendar.

Use defaultShow / show / onShowChange instead — visible is ignored when either of them is set.

weekdayFormat2number, '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 'long', 'narrow', and 'short', or provide a custom function to fully control how weekdays are displayed.

weekNumbersLabel5.0.0+-string

Defines the label that appears above the week numbers column. For example, you might label it 'WK' or 'Week #'. Without it the column is named for screen readers with the locale's word for week.

weekPlaceholder-string

Replaces the WW the week section shows while it is empty.

yearFormat5.24.0+'numeric''numeric', '2-digit'

Sets how the year cells of the years view write the year: 'numeric' (2026) or '2-digit' (26). The navigation always writes the full year.

yearPlaceholder-string

Replaces the YYYY the year section shows while it is empty.