Skip to content Web Components
Carousel
Slide 1
Slide 2
Slide 3
Carousels allow displaying a related set of content items in a limited space, by splitting the content into different frames. Users can navigate a carousel by interacting with the carousel arrows or dots pagination in larger viewports, or by a swipe gesture on tablet and mobile apps.
Stages, modals, articles collections and image galleries are all elements that can be displayed as carousels.
UX/UI Guidelines
Check the design documentation of the component in ZeroHeight.
Implementations
The component Carousel
is available in the following technologies:
Parameters
Parameters
Parameters are the attributes that can be used to customize the component when using it in a project. They apply to the WebComponents implementation and wrappers and to the Vue and React CSS implementations. Some parameters names change between the implementations, in order to follow the conventions of each technology and framework.
For example, the param model
is named ngModel
in Angular, modelValue
in Vue, but stays as model
in React.
By default, all the parameters are optional or can be set in different, except for the ones marked as required
The parametrization of the component can be done with the following custom params or properties:
Name | Type | Slottable | Description |
---|---|---|---|
config | string | Carousel configuration | |
overflow | boolean | ||
no-loop | boolean | ||
items | number | Number of items | |
delay | number | Delay between slides. Minimum value must be 1000ms | |
custom | object | A record of key-value pairs to set the CSS custom tokens. It's a complex attribute set as an JS object in stringified JSON format. Example: html
| |
custom-str | string | The stringified version of the Example: html
| |
z-theme | string | Sets the theme of the component. The possible values are html
|
From Figma to code
...
Customization
INFO
Check everything about the customization mechanics in the "How it works" documentation.
CSS Variable | Type | Description |
---|---|---|
--z-carousel--width | distance | Width of the carousel |
--z-carousel--height | distance | Height of the carousel |
--z-carousel--gap | distance | ... |
--z-carousel--squint | distance | |
--z-carousel--bg | color | Background for for odd slides |
--z-carousel--bg--even | color | Background for even slides |
--z-carousel--button-bg | color | Arrow buttons color |
--z-carousel--button-bg--hover | color | Arrow buttons hover color |
--z-carousel--button-color | color | Arrow buttons color |
--z-carousel--button-distance | distance | Distance for arrow buttons |
--z-carousel--dot-bg | color | Background for the inactive dots |
--z-carousel--dot-bg--hover | color | Background for inactive dots when hovered |
--z-carousel--dot-bg--active | color | Background for the active dot |
--z-carousel--dot-size | distance | Size of the dots |
--z-carousel--dot-padding | distance | Padding of the dots |
Accessibility
...