React Calendar Component API
Calendar API
Limited-time offer for the first 100 customers in 2025. Use code 2025SKY25 at checkout.
Explore the API reference for the React Calendar component and discover how to effectively utilize its props for customization.
CCalendar#
import { CCalendar } from '@coreui/react-pro'// orimport CCalendar from '@coreui/react-pro/src/components/calendar/CCalendar'
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 Calendar 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 Calendar 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 Calendar 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 Calendar component. Use it to enhance the experience for screen readers and further accessibility. | ||
calendarDate# | startDate || endDate || null | string , Date |
Defines the initial date or reference date for the React Calendar component. This date can be either a Date object or a string that can be converted into a valid date. | ||
calendars# | 1 | number |
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 |
A string of all classNames you want to apply to the outermost container of the React Calendar component. Use this to style or theme your calendar. | ||
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. | ||
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. | ||
endDate# | - | string , Date |
Defines the initially selected ending date (applicable when using range selection). Accepts both Date objects and valid date strings. | ||
firstDayOfWeek# | 1 | number |
Sets the first day of the week. This can be adjusted for different locales or preferences:
| ||
locale# | default | string |
Indicates the locale for the React Calendar 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. | ||
navigation# | true | boolean |
Toggles display of arrow-based navigation (previous/next controls) in the React Calendar 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 Calendar 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. | ||
onCalendarDateChange# | - | (date: string | Date) => void |
Callback fired when the calendar's reference date (i.e., the date indicating which month/year is currently displayed) changes. Receives the new | ||
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. | ||
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. | ||
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. | ||
range# | - | boolean |
Enables range selection mode in your React Calendar component, allowing users to select two dates for a range (start and end). Once enabled, the component will manage state for both dates. | ||
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 Calendar component. Supports:
| ||
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. | ||
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. | ||
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 |