shadow
A Carousel is an element that displays multiple items, such as images or news updates, in a rotating fashion.
This example shows the simplest carousel with several slides and default controls, so the baseline slide-to-slide behavior is easy to understand.
This example enables pagination controls so you can see how users can move between slides without relying on gestures or arrows.
This example disables infinite looping, so the first and last slide behave like real boundaries.
This example places the carousel inside a dialog to show how it behaves in the constrained space of an overlay.
This example adds thumbnail previews that act as secondary navigation between slides.
This example works with spacing between slides and around the viewport so you can compare a tighter and a more airy layout rhythm.
This example splits the available space so that multiple slides stay visible at the same time, which is useful for galleries or dense overviews.
Use wje-carousel to improve readability, scannability, and contextual understanding of content.
Do not replace structured interactive data with media-only presentation when precision is needed.
Provide alt text, maintain readable contrast, and include text equivalents for icon-only controls.
- Compress media and use lazy loading in larger collections.
- Keep information priority consistent across cards/lists.
- Avoid duplicating the same meaning in icon and text without added value.
| Description | Active slide attribute. |
| Attribute | active-slide |
| Type | number|number |
| Default | 0 |
| Description | Continuous loop attribute. |
| Attribute | continuous-loop |
| Type | boolean |
| Default | false |
| Description | Controls whether loop is enabled and affects component behavior. |
| Attribute | loop |
| Type | boolean |
| Default | false |
| Description | Controls whether navigation is enabled and affects component behavior. |
| Attribute | navigation |
| Type | boolean |
| Default | false |
| Description | Controls whether pagination is enabled and affects component behavior. |
| Attribute | pagination |
| Type | boolean |
| Default | false |
slidePerPage
| Description | Sets the numeric value used for slide-per-page. |
| Attribute | slide-per-page |
| Type | number |
| Default | 1 |
| Description | Controls whether thumbnails is enabled and affects component behavior. |
| Attribute | thumbnails |
| Type | boolean |
| Default | false |
No events available for this component.
| Description | Sync activeSlide to the slide whose leading edge is closest to the snap start. |
| Signature | () => void |
| Description | Syncs computed CSS variables derived from slide-per-page. |
| Signature | () => void |
| Description | Returns the inline scroll padding used by the snap area. |
| Signature | () => number |
| Description | Returns the interaction scroll behavior for UI controls. Continuous multi-slide loops use instant snapping to avoid blank edge states while the browser is still animating a previous smooth scroll. |
| Signature | () => ScrollBehavior|string |
| Description | Goes to the slide. |
| Signature | (index: any, behavior: any, next: any) => void |
| Description | Sets the active class on the currently targeted visual slide and removes it elsewhere. |
| Signature | (vIndex: number) => void |
| Description | Creates a sanitized loop clone that does not inherit transient render state such as inline visibility: hidden from the source slide. |
| Signature | (item: HTMLElement) => HTMLElement |
| Description | Removes loop clones so they can be rebuilt for the current configuration. |
| Signature | () => void |
| Description | Returns how many slides should be cloned on each side when loop is enabled. |
| Signature | (totalSlides: number) => number |
| Description | Scrolls the carousel to a visual slide index. |
| Signature | (vIndex: number, behavior: ScrollBehavior|string) => void |
| Description | Goes to the next slide. |
| Signature | () => void |
| Description | Goes to the previous slide. |
| Signature | () => void |
| Description | Goes to the slide. |
| Signature | () => Array |
| Description | Returns the maximum logical slide index that can still render a full viewport. |
| Signature | (totalSlides: number) => number |
| Description | Normalizes a logical index for the active loop mode. |
| Signature | (index: number, totalSlides: number) => number |
| Description | Returns how many logical positions are reachable for the current loop mode. |
| Signature | (totalSlides: number) => number |
| Description | Returns the pagination indexes for the current carousel mode. |
| Signature | () => number[] |
| Description | Goes to the slide. |
| Signature | () => boolean |
| Description | Goes to the slide. |
| Signature | () => boolean |
No CSS shadow parts available for this component.
| Name | Description |
|---|
--wje-carousel-size | Effective size of one carousel item. |
--wje-carousel-gap | Gap between carousel items. |
| Name | Description |
|---|
default | Default slot for the main component content. |