To switch content without delimiters and autoplay, take CdsSlideView — the carousel is built on top of it; for a single image take CdsImage.
Anatomy
A carousel is made of slides, navigation arrows, delimiter dots and an optional progress bar. Arrows and dots loop around: the first slide follows the last one.
Variations
Images
CdsCarouselItem combines a slide and CdsImage — pass it any image prop: src, alt, cover, gradient. The height prop sets the height of the carousel (500 by default).
Custom content
A slide does not have to be an image: put any markup into the slot of CdsCarouselItem and it stretches over the whole frame.
Autoplay
The cycle prop flips the slides automatically, interval sets the pause in milliseconds (6000 by default). The timer restarts after a manual switch, so the reader always has time to finish looking at a slide.
Progress
The progress prop adds a position bar at the bottom of the carousel. A string value sets its color — any of the tokens that CdsProgressBar accepts.
Delimiters
Props control the navigation dots: hide-delimiters removes them completely, hide-delimiter-background removes only the backdrop, vertical-delimiters (left / right) puts the dots vertically along the edge, and delimiter-icon changes the dot icon.
The item slot replaces a dot with your own element: it receives the ready-made delimiter props (click handler, aria-label, active class) and the group item itself — all that is left is to bind them with v-bind.
Arrows
The arrow props are inherited from CdsSlideView: show-arrows="hover" shows them on hover only, :show-arrows="false" removes them completely, prev-icon / next-icon change the icons, and the prev / next slots replace the buttons themselves.
Guidelines
Scenarios
Promo banners
The classic banner rotation: cycle with a 5 second interval flips the slides on its own, progress shows when the next one comes. The text and the button live in the slide slot, and the gradient from CdsImage darkens the top of the frame beneath them — so they stay readable on any image.
Gallery with thumbnails
The dots are replaced by thumbnails: hide-delimiters removes the built-in delimiters, and a click on a thumbnail changes v-model. The counter next to it reads the same v-model — the carousel, the thumbnails and the counter always stay in sync.
Vertical feed
A stories feed in the spirit of social networks: direction="vertical" flips the frames top to bottom, vertical-arrows="left" and vertical-delimiters="right" pull the arrows and the dots apart to the side edges and free up the frame. The author card and the counter sit in an absolute layer above the carousel: pointer-events-none lets clicks through to the arrows, and a transition keyed by v-model swaps the card together with the slide.
Onboarding
Product introduction steps: the arrows are off (:show-arrows="false"), the movement is driven by the "Back" and "Next" buttons through v-model. On the last step "Next" turns into a call to action.
API
CdsCarousel
Props
| Name | Type | Default | Description |
|---|---|---|---|
color | string | undefined | — | Color of the active delimiter and of the progress bar |
continuous | boolean | undefined | true | Loops the navigation: from the last slide you move to the first one and back |
crossfade | boolean | undefined | — | Slides change with a smooth crossfade instead of a shift |
cycle | boolean | undefined | — | Flips the slides automatically after the given interval |
delimiterIcon | IconValue | undefined | 'dot' | Icon of the delimiter (navigation dot) |
direction | "horizontal" | "vertical" | undefined | 'horizontal' | Switches the component between horizontal and vertical layout. |
disabled | boolean | null | undefined | null | Disabled state |
height | string | number | undefined | 500 | Height of the carousel |
hideDelimiterBackground | boolean | undefined | — | Hides the backdrop under the delimiters |
hideDelimiters | boolean | undefined | — | Hides the delimiters (navigation dots) |
interval | string | number | undefined | 6000 | Autoplay interval in milliseconds (when cycle is on) |
mandatory | boolean | "force" | undefined | 'force' | Requires at least one item to stay selected |
max | number | undefined | — | Maximum number of items that can be selected |
modelValue | any | — | Value of the selected items of the group |
multiple | boolean | undefined | — | Allows selecting several items at once |
nextIcon | IconValue | undefined | 'chevron-right' | Icon of the button that moves to the next slide |
prevIcon | IconValue | undefined | 'chevron-left' | Icon of the button that moves to the previous slide |
progress | string | boolean | undefined | — | Shows the progress bar of the current slide. A string sets the color of the bar |
required | boolean | "force" | undefined | — | Requires at least one item to stay selected |
reverse | boolean | undefined | — | Inverts the direction of the transition animation between slides |
selectedClass | string | undefined | — | CSS class applied in the selected state |
showArrows | string | boolean | undefined | true | Shows the navigation arrows. 'hover' — only while the pointer is over the component |
tag | string | JSXComponent<any> | undefined | 'div' | Custom HTML tag or component to render |
theme | string | undefined | — | Component theme |
touch | boolean | TouchHandlers | undefined | — | Controls swipe navigation: false turns the gestures off, an object sets your own touch handlers |
transitionDuration | number | undefined | — | Duration of the transition animation between slides, in milliseconds |
verticalArrows | boolean | "left" | "right" | undefined | — | Places the navigation arrows vertically: 'left' or 'right' — the side, true — the default side |
verticalDelimiters | boolean | "left" | "right" | undefined | — | Vertical placement of the delimiters: left, right or true (left) |
Events
| Name | Type | Description |
|---|---|---|
update:modelValue | [] | Fires when the active slide changes. |
Slots
| Name | Type | Description |
|---|---|---|
default | { group: GroupProvide; } | Slides. The slot props carry the group state for controlling the active slide |
item | { props: CarouselDelimiterProps; item: { id: string; value: unknown; disabled: boolean | undefined; }; } | Custom delimiter (navigation dot) for each slide. |
next | { props: ControlProps; } | Button that moves to the next slide. The slot props are ready to bind to your own button |
prev | { props: ControlProps; } | Button that moves to the previous slide. The slot props are ready to bind to your own button |
CdsCarouselItem
Props
| Name | Type | Default | Description |
|---|---|---|---|
absolute | boolean | undefined | — | Positions the image with position: absolute, filling its parent. |
alt | string | undefined | — | Alternative text of the image (the alt attribute). |
aspectRatio | string | number | undefined | — | Aspect ratio of the content. For example 1.7778 (16/9) or '4/3'. |
color | string | undefined | — | Background color of the placeholder shown while loading. |
contentClass | any | — | CSS class applied to the content wrapper. |
cover | boolean | undefined | — | Scales the image so that it covers the whole container (object-fit: cover). |
crossorigin | "" | "anonymous" | "use-credentials" | undefined | — | Value of the crossorigin attribute. |
disabled | boolean | null | undefined | null | Disabled state |
draggable | boolean | "true" | "false" | undefined | — | Controls whether the image can be dragged (the draggable attribute). |
eager | boolean | undefined | — | Renders the content of the component right away. Useful when you have content that is not in the DOM but has to be indexed for SEO. |
gradient | string | undefined | — | CSS gradient laid over the image. For example 'to top, rgba(0,0,0,.4), transparent'. |
height | string | number | undefined | — | Component height |
imageClass | any | — | CSS class applied to the inner <img> element. |
inline | boolean | undefined | — | Renders the component as an inline block (inline-flex) instead of a block one. |
lazySrc | string | undefined | — | Source of the low-quality placeholder image shown until the main one loads. |
maxHeight | string | number | undefined | — | Maximum component height |
maxWidth | string | number | undefined | — | Maximum component width |
minHeight | string | number | undefined | — | Minimum component height |
minWidth | string | number | undefined | — | Minimum component width |
options | IntersectionObserverInit | undefined | {} | IntersectionObserver options for lazy loading. |
position | string | undefined | — | Value of object-position that places the image inside the container. |
referrerpolicy | "origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined | — | Value of the referrerpolicy attribute. |
reverseTransition | string | boolean | undefined | — | Transition used when the slide appears in the reverse direction. A transition component name, or false to turn the animation off |
selectedClass | string | undefined | — | CSS class applied in the selected state |
sizes | string | undefined | — | Value of the sizes attribute for responsive images. |
src | string | CdsImageSrcObject | undefined | '' | Image source. A string or an object with src/srcset/lazySrc/aspect. |
srcset | string | undefined | — | Set of image sources for different resolutions (the srcset attribute). |
theme | string | undefined | — | Component theme |
transition | string | boolean | undefined | — | Transition used when the slide appears in the forward direction. A transition component name, or false to turn the animation off |
value | any | — | Value of the component within the group |
width | string | number | undefined | — | Component width |
Slots
| Name | Type | Description |
|---|---|---|
default | any | Content shown over the image. |
error | any | Content shown when the image fails to load. |
placeholder | any | Content shown while the image is loading. |
sources | any | Extra <source> elements for the <picture> tag. |