Carousel

Horizontal slide rotator built on CSS scroll-snap. Arrows, pagination dots, optional autoplay with pause-on-hover.

Usage

import { Carousel } from '@bwo-ui/react';

<Carousel aspectRatio="16 / 9" autoplay={4000}>
  <img src="/1.jpg" alt="Slide one" />
  <img src="/2.jpg" alt="Slide two" />
  <img src="/3.jpg" alt="Slide three" />
</Carousel>

Props

PropTypeDefaultDescription
showArrowsbooleantrueToggle the prev/next arrows.
showDotsbooleantrueToggle the pagination dots.
loopbooleantrueWrap around at the ends.
autoplaynumberAuto-advance interval in ms. Omit / 0 to disable.
pauseOnHoverbooleantruePause autoplay while the cursor is over the carousel.
indexnumberControlled active index (0-based).
defaultIndexnumber0Uncontrolled initial index.
onIndexChange(i: number) => voidCalled when the active slide changes.
aspectRatiostringForwarded to the viewport (e.g. "16 / 9").

The exposed ref implements { next(), prev(), goTo(i) } for imperative control.