Carousel
Scrolls through slides one at a time.
Installation
pnpm dlx shadcn@latest add @paneui/carouselUsage
Composition
Examples
Behaviour
Slides scroll with native snapping, so touch, trackpad and wheel feel like the platform. ←/→ (↑/↓ when vertical) step one slide; with reduced motion the step jumps instead of scrolling smoothly.
Accessibility
The root is a region with aria-roledescription="carousel" and each item a slide group. Label both, for example "2 of 5" on items.
Carousel
Also accepts every prop of div.
- orientation= "horizontal"
- "horizontal" | "vertical"
- Scroll axis. A vertical carousel needs a height.
- loop= false
- boolean
- Buttons and keys wrap at the ends.
- onIndexChange
- (index: number) => void
- Called when the current slide changes.
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | "horizontal" | "vertical" | "horizontal" | Scroll axis. A vertical carousel needs a height. |
| loop | boolean | false | Buttons and keys wrap at the ends. |
| onIndexChange | (index: number) => void | — | Called when the current slide changes. |
CarouselContent
The scroll container; className goes on the track (gap, padding). Also accepts every prop of div.
CarouselPrevious / CarouselNext
Also accepts every prop of Button.
- variant= "secondary"
- Button variant
- size= "icon-sm"
- Button size
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | Button variant | "secondary" | |
| size | Button size | "icon-sm" |