An infinite 3D perspective cover flow carousel featuring fluid spring physics, drag momentum, circular looping, and distinct layout presets.
$ npx shadcn@latest add https://akshitr.com/r/cover-flow-carousel.json
import CoverFlowCarousel from "@/components/cover-flow-carousel";
export default function Example() {
return (
<CoverFlowCarousel
preset="coverflow"
autoplay={true}
autoplayInterval={3500}
pauseOnHover={true}
/>
);
}The carousel includes 5 meticulously tuned 3D spatial presets ("coverflow", "classic", "stack", "flat", "dramatic") altering the wing angle, lateral card spread, Z-depth recession, and lighting occlusions.
| Prop | Type | Default | Description |
|---|---|---|---|
items | CoverFlowItem[] | DEFAULT_COVERFLOW_ITEMS | Array of carousel slide items with id, title, subtitle, and image. |
preset | "coverflow" | "classic" | "stack" | "flat" | "dramatic" | "coverflow" | 3D spatial preset controlling angle, spacing, scale, and depth. |
initialIndex | number | 2 | Index of the card selected on initial mount. |
cardWidth | number | 300 | Base width of the cards in pixels. |
cardHeight | number | 310 | Height of the artwork image inside the card in pixels. |
mobileScale | number | 0.72 | Scale multiplier automatically applied on viewports < 640px. |
autoplay | boolean | true | Automatically advance slides on an interval. |
autoplayInterval | number | 3000 | Duration in milliseconds between auto-advancements. |
pauseOnHover | boolean | true | Pause autoplay when the mouse hovers over the stage. |
onChange | (item: CoverFlowItem, index: number) => void | - | Callback fired whenever the active card changes. |