Carousel
Swipeable content rail with previous and next controls. Use it for product galleries, testimonial rails, editorial highlights, and any horizontally scrollable content.
Best for
Import
import { Carousel } from "@enadhq/enad-react-sdk/client/ui-resolver"When to use it
Use Carousel when content should scroll horizontally with swipe and arrow controls. It fits product image galleries, recommendation rails, testimonial sliders, editorial highlights, and any horizontal browsing pattern where showing one or a few items at a time is more engaging than a full grid.
If the content should all be visible at once (like a responsive product grid), do not wrap it in a carousel. Carousels work best when the hidden content builds anticipation or when horizontal space is limited.
Slot strategy
Carousel is built on Embla Carousel with four visible pieces:
Carouselis the root container. It acceptsoptsfor Embla configuration (alignment, loop, drag behavior),orientationfor horizontal or vertical scrolling, andwheelAxisto control scroll/trackpad behavior.CarouselContentis the scrollable track that holds the slides.CarouselItemwraps each slide. Control how many slides are visible at once withbasis-*classes (e.g.basis-1/2for two-up,basis-1/3for three-up).CarouselPreviousandCarouselNextare arrow buttons positioned at the edges of the carousel.
Behavior and theming guidance
The carousel supports touch swipe, mouse drag, and keyboard navigation out of the box. Arrow buttons disable automatically when the carousel reaches the first or last slide (unless loop: true is set in opts).
Use wheelAxis to control scroll behavior. The default "vertical" lets the page scroll normally on vertical swipes. Set "horizontal" to enable horizontal trackpad swiping, or "both" to capture vertical scroll for the carousel (use sparingly, as it can interfere with page scrolling).
Pass Embla options through the opts prop for advanced behavior like align: "start" (left-align slides instead of centering), loop: true (infinite cycling), or dragFree: true (momentum-based scrolling without snap points).
For product galleries where you need programmatic control (jump to a specific slide, listen to scroll events), use the setApi callback to capture the Embla API instance.
Examples
Live examples you can edit directly in the sandbox.
Simple slide rail
A minimal carousel with numbered slides and arrow controls. Good for testing layout before adding real content.
Product teaser rail
A multi-item rail with fractional widths. Use basis-1/2 or basis-1/3 on CarouselItem to show several slides at once, like a product recommendation strip.
Component Sets
Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| opts | string | — | No description yet. |
| plugins | string | — | No description yet. |
| orientation | string | — | No description yet. |
| wheelAxis | string | — | Controls which wheel/trackpad axes scroll the carousel.
- `"vertical"` — vertical scroll hijacks carousel (default, mouse-wheel-friendly)
- `"horizontal"` — horizontal trackpad swipes scroll carousel, vertical passes through
- `"both"` — both axes scroll the carousel
- `false` — no wheel gestures (touch drag still works) |
| setApi | string | — | No description yet. |