Migration to v5
Track and review changes to the CoreUI for React.js components to help you migrate from v4 to v5.
CoreUI for React is the React.js version of CoreUI components library, so before read this migration guide, please check also CoreUI 4 to 5 migration guide.
Dependencies
- Breaking React 18 or newer is required. The peer range still reads
>=17, butCAccordionItem,CAutocomplete,CMultiSelect,CNavGroup,CPopover,CRating,CStepper,CTabsandCTooltipuse React’suseId, which React 17 does not have. @coreui/coreui-prois no longer a peer dependency.@coreui/react-proinstalls it as its own dependency. If your app imports the CoreUI stylesheet or Sass, keep@coreui/coreui-proon the same 5.x version so that only one copy is installed.@popperjs/coreandprop-typeswere bundled into the v4 build. In v5 they are regular dependencies of@coreui/react-pro.date-fnsis no longer used or bundled. SeeCDatePickerandCDateRangePickerbelow.- Breaking The build moved from
dist/index.jsanddist/index.es.jstodist/cjs/anddist/esm/. Deep imports from@coreui/react-pro/dist/...break. Import from@coreui/react-proinstead.
Components
CAlertHeading
- Breaking Renamed
componentproperty toas.
CAvatar
- Deprecated
textColorvalues:muted,high-emphasis,medium-emphasis,disabled,high-emphasis-inverse,medium-emphasis-inverse,disabled-inverse. They still render, but TypeScript no longer suggests them. Usebodyinstead ofhigh-emphasis,body-secondaryinstead ofmutedandmedium-emphasis, andbody-tertiaryinstead ofdisabled. - New
textColorvalues:primary-emphasis,secondary-emphasis,success-emphasis,danger-emphasis,warning-emphasis,info-emphasis,light-emphasis,body,body-emphasis,body-secondary,body-tertiary,black,black-50,white-50.
CBadge
- Breaking Renamed
componentproperty toas. - Deprecated
textColorvalues:muted,high-emphasis,medium-emphasis,disabled,high-emphasis-inverse,medium-emphasis-inverse,disabled-inverse. They still render, but TypeScript no longer suggests them. Usebodyinstead ofhigh-emphasis,body-secondaryinstead ofmutedandmedium-emphasis, andbody-tertiaryinstead ofdisabled. - New
textColorvalues:primary-emphasis,secondary-emphasis,success-emphasis,danger-emphasis,warning-emphasis,info-emphasis,light-emphasis,body,body-emphasis,body-secondary,body-tertiary,black,black-50,white-50.
CButton
- Breaking Renamed
componentproperty toas. - Breaking The button doesn’t have a default color anymore, you have to add
color="primary"
CCalendar
- Breaking Renamed
onDayHoverevent toonDateHover. onStartDateChange,onEndDateChangeandonDateHoverreceiveDate | string | null. The value is a string whenselectionTypeisweek,month,quarteroryear. With the default day selection it is still aDate.
CCard
- Deprecated
textColorvalues:muted,high-emphasis,medium-emphasis,disabled,high-emphasis-inverse,medium-emphasis-inverse,disabled-inverse. They still render. Usebodyinstead ofhigh-emphasis,body-secondaryinstead ofmutedandmedium-emphasis, andbody-tertiaryinstead ofdisabled. - New
textColorvalues:primary-emphasis,secondary-emphasis,success-emphasis,danger-emphasis,warning-emphasis,info-emphasis,light-emphasis,body,body-emphasis,body-secondary,body-tertiary,black,black-50,white-50.
CCardHeader
- Breaking Renamed
componentproperty toas.
CCardImage
- Breaking Renamed
componentproperty toas.
CCardSubtitle
- Breaking Renamed
componentproperty toas.
CCardText
- Breaking Renamed
componentproperty toas.
CCardTitle
- Breaking Renamed
componentproperty toas.
CCloseButton
- Deprecated property
white, usedarkinstead of.
CDatePicker
-
Breaking Removed property
format, useinputDateFormatinstead of. In v4, settingformatalso made the input read-only. AddinputReadOnlyto keep that. If users may type a date, also passinputDateParse.// Previous markup <CDatePicker format="MMMM-dd-yyyy"/> // New markup import { format } from 'date-fns' //... <CDatePicker inputDateFormat={(date) => format(new Date(date), 'MMMM-dd-yyyy')} inputReadOnly /> -
onDateChangestill receives the date and the formatted date. The date is now typedDate | string | null. It is a string whenselectionTypeisweek,month,quarteroryear. With the default day selection it is still aDate.
CDateRangePicker
-
Breaking Removed property
format, useinputDateFormatinstead of. In v4, settingformatalso made the inputs read-only. AddinputReadOnlyto keep that. If users may type a date, also passinputDateParse.// Previous markup <CDateRangePicker format="MMMM-dd-yyyy"/> // New markup import { format } from 'date-fns' //... <CDateRangePicker inputDateFormat={(date) => format(new Date(date), 'MMMM-dd-yyyy')} inputReadOnly /> -
onStartDateChangeandonEndDateChangestill receive the date and the formatted date. The date is now typedDate | string | null. It is a string whenselectionTypeisweek,month,quarteroryear. With the default day selection it is still aDate.
CDropdown
- Breaking Renamed
componentproperty toas.
CDropdownHeader
- Breaking Renamed
componentproperty toas.
CDropdownItem
- Breaking Renamed
componentproperty toas.
CDropdownItemPlain
- Breaking Renamed
componentproperty toas.
CDropdownMenu
- Breaking Renamed
componentproperty toas.
CDropdownToggle
- Breaking Renamed
componentproperty toas. - Breaking The toggle doesn’t have a default color anymore, you have to add
color="primary"
CFormFeedback
- Breaking Renamed
componentproperty toas.
CFormText
- Breaking Renamed
componentproperty toas.
CHeaderBrand
- Breaking Renamed
componentproperty toas.
CHeaderNav
- Breaking Renamed
componentproperty toas.
CInputGroupText
- Breaking Renamed
componentproperty toas.
CLink
- Breaking Renamed
componentproperty toas.
CListGroup
- Breaking Renamed
componentproperty toas.
CListGroupItem
- Breaking Renamed
componentproperty toas.
CLoadingButton
- Breaking Renamed
componentproperty toas. - Breaking The button doesn’t have a default color anymore, you have to add
color="primary"
CModalTitle
- Breaking Renamed
componentproperty toas.
CMultiSelect
- Removed key
textin the options list, uselabelinstead
CNav
- Breaking Renamed
componentproperty toas. - Breaking The v4
underlinelook is now theunderline-bordervariant.variant="underline"is a new style without the line under the whole nav.
CNavbar
- Breaking Renamed
componentproperty toas.
CNavbarBrand
- Breaking Renamed
componentproperty toas.
CNavbarNav
- Breaking Renamed
componentproperty toas.
CNavItem
-
Breaking In v4,
CNavItemwithhrefortopassedcomponentto theCNavLinkit renders inside the<li>. In v5,asreplaces the<li>itself and is not passed to the link. Render the link yourself:// Previous markup <CNavItem component={NavLink} to="/dashboard">Dashboard</CNavItem> // New markup <CNavItem> <CNavLink as={NavLink} to="/dashboard">Dashboard</CNavLink> </CNavItem>
CNavLink
- Breaking Renamed
componentproperty toas.
CNavTitle
- Added
asproperty to set the root element.
COffcanvasTitle
- Breaking Renamed
componentproperty toas.
CPaginationItem
- Breaking Renamed
componentproperty toas.
CPlaceholder
- Breaking Renamed
componentproperty toas.
CSidebar
- Breaking Sidebar has a light color scheme by default, use
colorScheme="dark"to make it dark.
CSpinner
- Breaking Renamed
componentproperty toas.
CToastClose
- Breaking Renamed
componentproperty toas. - Deprecated property
white, usedarkinstead of.