Carousel
An equal-size slide carousel with continuous dragging, native scroll snapping, responsive viewport capacity, and keyboard navigation.
Base Carousel pairs an equal-size slide strip with a continuously scrollable viewport and Previous/Next controls. Pointer/touch dragging, wheel/trackpad scrolling, and keyboard navigation all snap to the nearest reachable slide boundary.
Preview
Section titled “Preview”Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
Responsive viewport capacity
Section titled “Responsive viewport capacity”Use slidesPerView (default 1) to cap the maximum visible equal-size items and minSlideSize (default 0, in logical pixels) to set their minimum extent. Narrowing the viewport reduces visible capacity while keeping every slide’s layout extent intact. Root exposes visibleSlides and maxIndex, and the final snap aligns cleanly to the end of the strip without empty trailing space.
Controlled index and interaction state
Section titled “Controlled index and interaction state”- Pass
indexfor controlled mode. Drag release and navigation emitindexChangewith the proposed index; the committedindexremains unchanged while dragging until the owner updates it. Viewportexposesdragging,scrolling, and normalizedscrollPosition.Slideexposescurrent(matching the committed snap index) andhidden(tracking offscreen visibility without removing layout space).- When using
orientation="vertical", give the viewport an explicit height. Horizontaldirection="rtl"reverses physical dragging and arrow keys while keeping logical item order. - Setting
loop={true}wraps index navigation between the first and last reachable positions without cloning slides.
Root Props
Section titled “Root Props”Passing index selects controlled mode.
| Prop | Type | Default |
|---|---|---|
index | number | — |
slidesPerView | number | 1 |
minSlideSize | number | 0 |
defaultIndex | number | 0 |
loop | boolean | false |
disabled | boolean | false |
orientation | 'horizontal' 'vertical' | horizontal |
direction | 'ltr' 'rtl' | ltr |
a11yLabel | string | Carousel |
Other parts
Section titled “Other parts”- Viewport: no props.
- Slide: optional
index; omitted indexes follow DOM composition order.