Carousel

A slideshow component for cycling through elements with support for mouse drag, touch swipe, and automatic playback.

PreviousNext
1
2
3
4
5

Installation

1

Run the CLI

Use the CLI to add the component to your project.

npx @ngzard/ui@latest add carousel

Examples

default

1
2
3
4
5

dot controls

1
2
3
4
5

orientation

1
2
3
4
5

sizes

To set the size of the items, you can use the basis utility class on the <z-carousel-item />.

1
2
3
4
5

spacing

To set the spacing between the items, we use a pl-[VALUE] utility on the <z-carousel-item /> and a negative -ml-[VALUE] on the <z-carousel-content />.

1
2
3
4
5
6

Content class: -ml-4

Item class: basis-1/3 pl-4

api demo

1
2
3
4
5

Current slide: 1 / 0

Scroll progress: 0%

Can scroll prev: No

Can scroll next: No

Slides in view:

plugins

1
2
3
4
5

Current slide: 1 / 0

API

A carousel component with slide controls and swipe gesture support.

Property Description Type Default
[class] Additional CSS classes ClassValue ''
[zOptions] Embla Carousel configuration options. See the Embla Carousel docs for more information. EmblaOptionsType {loop: false}
[zPlugins] Embla Carousel plugins EmblaPluginType[] []
[zOrientation] Carousel orientation horizontal | vertical horizontal
[zControls] Navigation type buttons 'button' | 'dot' | 'none' button
(zInited) Emits Embla API when carousel is initialized EmblaCarouselType -
(zSelected) Emitted when a slide is selected void -

The content container for the carousel

Property Description Type Default
[class] Additional CSS classes ClassValue ''

An individual carousel item

Property Description Type Default
[class] Additional CSS classes ClassValue ''