# Migration to v5

> Track and review changes to the CoreUI for Vue.js components to help you migrate from v4 to v5.

CoreUI for Vue is the Vue.js version of CoreUI components library, so before read this migration guide, please check also [CoreUI 4 to 5 migration guide](https://coreui.io/bootstrap/docs/migration/v5/).

## Dependencies

- <span class="badge bg-danger">Breaking</span> The `vue` peer dependency changed from `^3.2.21` to `^3.5.0`. Upgrade Vue to 3.5 or newer.
- `@coreui/coreui-pro` is now a dependency of `@coreui/vue-pro`, not a peer dependency. Keep it in your own `package.json` if you import the stylesheet from it.
- `@popperjs/core` is now a dependency of `@coreui/vue-pro`. In v4 it was bundled into the build. You do not need to install it yourself.
- `date-fns` is no longer bundled. v4 used it for the `format` property of the date pickers. Install it yourself if you use it in `inputDateFormat`.
- <span class="badge bg-danger">Breaking</span> The build files moved. The ES build moved from `dist/index.es.js` to `dist/esm/index.js`, the CommonJS build from `dist/index.js` to `dist/cjs/index.js`, and the types from `dist/index.d.ts` to `dist/esm/index.d.ts`. Import from the package root, `@coreui/vue-pro`, instead of a build file.

## Components

### CAlertHeading

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CAvatar

- Deprecated `textColor` values: `muted`, `high-emphasis`, `medium-emphasis`, `disabled`, `high-emphasis-inverse`, `medium-emphasis-inverse`, `disabled-inverse`. The property validator no longer accepts them, so Vue logs a warning in development. The classes still render.
- New `textColor` values: `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`, `white-50`.

### CBadge

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.
- Deprecated `textColor` values: `muted`, `high-emphasis`, `medium-emphasis`, `disabled`, `high-emphasis-inverse`, `medium-emphasis-inverse`, `disabled-inverse`. The property validator no longer accepts them, so Vue logs a warning in development. The classes still render.
- New `textColor` values: `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`, `white-50`.

### CButton

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CCalendar

- <span class="badge bg-danger">Breaking</span> Renamed the `calendar-cell-hover` event to `date-hover`. It still emits the hovered date, or `null` when the pointer leaves.

### CCard

- Deprecated `textColor` values: `muted`, `high-emphasis`, `medium-emphasis`, `disabled`, `high-emphasis-inverse`, `medium-emphasis-inverse`, `disabled-inverse`. The property validator no longer accepts them, so Vue logs a warning in development. The classes still render.
- New `textColor` values: `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`, `white-50`.

### CCardHeader

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CCardImage

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CCardSubtitle

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CCardText

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CCardTitle

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CCloseButton

- Deprecated property `white`, use `dark` instead.

### CDatePicker

- <span class="badge bg-danger">Breaking</span> The `format` property no longer formats the date. Use `inputDateFormat` instead. Without `inputDateFormat`, the date is formatted with the `locale` property.

```vue
// Previous markup
<CDatePicker format="MMMM-dd-yyyy"/>

// New markup
import { format } from 'date-fns'
//...
<CDatePicker :inputDateFormat="(date) => format(new Date(date), 'MMMM-dd-yyyy')" />
```

- `format` still makes the input read-only, as it did in v4. If you remove it and want to keep the input read-only, set `inputReadOnly`.
- Pair a custom `inputDateFormat` with `inputDateParse`, so a typed date is read back with the same pattern.
- The `date-change` event still emits the date object and the formatted string. The formatted string now follows `inputDateFormat`, or the `locale` property, instead of `format`.

### CDateRangePicker

- <span class="badge bg-danger">Breaking</span> The `format` property no longer formats the date. Use `inputDateFormat` instead. Without `inputDateFormat`, the date is formatted with the `locale` property.

```vue
// Previous markup
<CDateRangePicker format="MMMM-dd-yyyy"/>

// New markup
import { format } from 'date-fns'
//...
<CDateRangePicker :inputDateFormat="(date) => format(new Date(date), 'MMMM-dd-yyyy')" />
```

- `format` still makes the inputs read-only, as it did in v4. If you remove it and want to keep the inputs read-only, set `inputReadOnly`.
- Pair a custom `inputDateFormat` with `inputDateParse`, so a typed date is read back with the same pattern.
- The `start-date-change` and `end-date-change` events still emit the date object and the formatted string. The formatted string now follows `inputDateFormat`, or the `locale` property, instead of `format`.
- <span class="badge bg-danger">Breaking</span> Removed the `indicator`, `cleaner` and `separator` slots. The icons come from the stylesheet. The `indicator`, `cleaner` and `separator` properties still show or hide them.

### CDropdown

- The default `variant` changed from `btn-group` to `dropdown`. The wrapper gets the `.dropdown` class instead of `.btn-group`. Set `variant="btn-group"` to keep the v4 markup.

### CDropdownHeader

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CDropdownItem

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CDropdownMenu

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CDropdownToggle

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.
- <span class="badge bg-danger">Breaking</span> Removed property `active`. Add `class="active"` if you need the style.

### CFormFeedback

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CFormRange

- <span class="badge bg-danger">Breaking</span> Renamed `steps` property to `step`.

### CFormText

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CHeaderBrand

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CHeaderNav

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CInputGroupText

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CLink

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CListGroup

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CListGroupItem

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CLoadingButton

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CModalTitle

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CMultiSelect

- <span class="badge bg-danger">Breaking</span> Removed key `text` in the options list, use `label` instead.

### CNav

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.
- The `underline` variant has been changed to `underline-border`. Use `variant="underline-border"` to keep the v4 look. `underline` is now a different, simpler style.

### CNavbar

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CNavbarBrand

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CNavbarNav

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CNavItem

- <span class="badge bg-danger">Breaking</span> Removed property `component`. In v4 it set the element of the inner link. In v5, `as` sets the element of the wrapper, `li` by default. To change the link element, put a `CNavLink` inside.

```vue
// Previous markup
<CNavItem component="button" href="#">Docs</CNavItem>

// New markup
<CNavItem>
  <CNavLink as="button" href="#">Docs</CNavLink>
</CNavItem>
```

### CNavLink

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### COffcanvasTitle

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CPaginationItem

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CPlaceholder

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CProgress

- New `CProgressStacked` component for stacked bars. Put one `CProgress` per segment inside it. Several `CProgressBar` elements inside one `CProgress` still render.

```vue
// Previous markup
<CProgress>
  <CProgressBar :value="15" />
  <CProgressBar color="success" :value="30" />
</CProgress>

// New markup
<CProgressStacked>
  <CProgress :value="15" />
  <CProgress color="success" :value="30" />
</CProgressStacked>
```

### CSidebar

- <span class="badge bg-danger">Breaking</span> Sidebar has a light color scheme by default, use `colorScheme="dark"` to make it dark.
- Without the `visible` property, the sidebar is now shown on desktop. In v4 it was hidden. An `overlaid` sidebar still starts hidden.

### CSpinner

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.

### CTimePicker

- <span class="badge bg-danger">Breaking</span> Removed the `indicator` and `cleaner` slots. The icons come from the stylesheet. The `indicator` and `cleaner` properties still show or hide them.

### CToastClose

- <span class="badge bg-danger">Breaking</span> Renamed `component` property to `as`.
- Deprecated property `white`, use `dark` instead.

### CToastHeader

- <span class="badge bg-danger">Breaking</span> Removed the `close` event. Listen to the `close` event of the parent `CToast` instead.

```vue
// Previous markup
<CToast>
  <CToastHeader closeButton @close="onClose">Title</CToastHeader>
</CToast>

// New markup
<CToast @close="onClose">
  <CToastHeader closeButton>Title</CToastHeader>
</CToast>
```

## Directives

### v-c-popover and v-c-tooltip

- <span class="badge bg-danger">Breaking</span> `content` and `header` are inserted as text, not HTML. Markup in the value shows as literal tags. For HTML content, use `CPopover` or `CTooltip` and the `content` slot (and the `title` slot of `CPopover`).
