Carousel
Carousel shows a set of slides that readers move through one at a time. Use it for galleries and featured content. Install the embla-carousel-react peer dependency first.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Vertical
Scroll slides vertically, with a fixed height on CarouselContent.
Props
Carousel
| Prop | Type | Default | Description |
|---|---|---|---|
opts | Partial<OptionsType> | No default documented | Embla options, such as |
orientation | "horizontal" | "vertical" | "horizontal" | Scroll axis. |
plugins | CreatePluginType<LoosePluginType, {}>[] | No default documented | Embla plugins, such as autoplay or wheel gestures. |
setApi | ((api: EmblaCarouselType) => void) | No default documented | Receives the Embla API after setup, for external control. |
CarouselContent
CarouselContent adds no props of its own; it accepts the props of the element or primitive it wraps.
CarouselItem
CarouselItem adds no props of its own; it accepts the props of the element or primitive it wraps.
CarouselNext
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child, such as an |
endIcon | ReactNode | No default documented | Decorative icon after the label. Use |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "icon" | No description |
startIcon | ReactNode | No default documented | Decorative icon before the label. Use |
variant | "link" | "default" | "error" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | null | "outline" | No description |
CarouselPrevious
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child, such as an |
endIcon | ReactNode | No default documented | Decorative icon after the label. Use |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "icon" | No description |
startIcon | ReactNode | No default documented | Decorative icon before the label. Use |
variant | "link" | "default" | "error" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | null | "outline" | No description |
Carousel shows a set of slides that readers move through one at a time. Use it for galleries and featured content. Install the embla-carousel-vue peer dependency first.
Installation
Install these components first:
Install the following dependencies:
Copy and paste the following code into your project.
components/carousel/Carousel.vue components/carousel/CarouselContent.vue components/carousel/CarouselItem.vue components/carousel/CarouselNext.vue components/carousel/CarouselPrevious.vue components/carousel/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Vertical
Scroll slides vertically, with a fixed height on CarouselContent.
Props
Carousel
| Prop | Type | Default | Description |
|---|---|---|---|
opts | Partial<OptionsType> | No default documented | Embla options, such as |
orientation | "vertical" | "horizontal" | "horizontal" | Scroll axis. |
plugins | CreatePluginType<LoosePluginType, {}>[] | No default documented | Embla plugins, such as autoplay or wheel gestures. |
setApi | ((api: EmblaCarouselType) => void) | No default documented | Receives the Embla API after setup, for external control. |
CarouselContent
CarouselContent adds no props of its own; it accepts the props of the element or primitive it wraps.
CarouselItem
CarouselItem adds no props of its own; it accepts the props of the element or primitive it wraps.
CarouselNext
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | No default documented | No description |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "icon" | No description |
type | "button" | "submit" | "reset" | "button" | No description |
variant | "default" | "destructive" | "error" | "outline" | "dashed" | "secondary" | "ghost" | "link" | null | "outline" | No description |
CarouselPrevious
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | No default documented | No description |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "default" | "sm" | "lg" | "icon-sm" | "icon" | "icon-lg" | null | "icon" | No description |
type | "button" | "submit" | "reset" | "button" | No description |
variant | "default" | "destructive" | "error" | "outline" | "dashed" | "secondary" | "ghost" | "link" | null | "outline" | No description |