Skip to content
My content My content My content My content My content My content My content My content
Carousel - Web Component
The Carousel component can be used imported from:
Playground
Parameters
...
Events
This component has events. Check the documentation about how to use the events.
Name | Payload | Description |
---|---|---|
change | number | Fires when the slide changes |
Slots
This component has slots. Check the documentation about how to use the slots.
Name | Tags | Description |
---|---|---|
slide-<number> | span | Slot for the slide content. The number is the index of the slide. |
Parameters use
config
The config
attribute is used to customize the interaction components of the carousel. The interaction components are the dots and the navigation arrows.
The first modifier is the arrows
styling. The possible values are: circle
, chevron
or semi
.
The second modifier is the dots
position. Possible values are: center
, left
, right
.
The third modifier adds navigation to the dots using nav
. Requires some dots
config.
You can combine the two modifiers separating them with a (:
). The patter would be <?arrows>:<?dots>:<?nav>
.
delay
The delay
attribute is used to define the time in milliseconds between each slide.
Slides
Make sure for each slide to use the slot
attribute with the value slide-<number>
. The number should be incremental.
Special uses
Card gallery
We can create nice galleries using the overflow version of Carousel
. We recommend to set the no-loop
flag and play with the --z-carousel--squint
value. The gallery navigation can be done in chunks, where those have the same gap as the carousel slides to make a continuos effect.
So adding some style:
scss
#my-gallery {
width: calc(100% - var(--zs-600));
margin: 0 auto;
> [slot^="slide-"] {
grid-template-columns: 1fr 1fr 1fr;
gap: var(--zs-100);
}
}
We can the write the component:
Browser support
Detected engine:
Chromium
Webkit
Gecko