Carousel
FREEScroll-snap slider with swipe, mouse drag, arrows, dots, autoplay and loop. No carousel library.
Installation
Terminal
npx @bloxa/cli add carousel
# or: npx shadcn@latest add @bloxa/carouselExamples
Autoplay and multiple per view
Swipe, drag with a mouse or use the arrow keys.
API reference
Every component also accepts the props of the element it renders.
Carousel
Put CarouselContent (holding CarouselItems), CarouselControls and CarouselDots inside. useCarousel() exposes the state.
| Prop | Type | Default | Description |
|---|---|---|---|
| perView | number | 1 | Slides visible at once. |
| gap | string | "1rem" | Gap. |
| loop | boolean | false | Wrap around. |
| autoplay | number | — | Auto-advance in ms; pauses on hover. |
| label | string | — | Accessible name. |