Cinematic Card Carousel
A cinematic depth-based card gallery — one sharp hero portrait stays dominant in the center while neighbors compress behind it with progressive scale, blur, and fade. Drag, swipe, or click any card to promote it with weighted spring physics.
Installation#
pnpm dlx shadcn@latest add @davinciui/cinematic-card-carouselUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
itemsCards shown in the deck. Each item has id, src, optional type ('image' | 'video'), title, description, and alt. | CinematicCardItem[] | — |
initialIndexCard that starts in the center hero position. | number | 0 |
loopWrap past the last card back to the first (and vice versa) with no visible reset. | boolean | true |
autoPlayIntervalAdvance the deck automatically every N milliseconds. Disabled by default and when reduced motion is requested. | number | — |
onIndexChangeCallback fired when the active card changes. | (index: number) => void | — |
wheelNavigationSideways trackpad/mouse scroll moves the deck. "both" also captures vertical scroll; vertical page scroll is never trapped in "horizontal" mode. | false | "horizontal" | "both" | "horizontal" |
showArrowsShow minimal translucent previous/next edge controls. | boolean | true |
classNameAdditional CSS classes for the gallery container. | string | — |
Accessibility#
The deck is a focusable carousel region with left and right arrows. Only the active card is tabbable and can be promoted with Enter or Space, and a polite live region announces card and title.
Motion#
Cards move with a Framer Motion spring at stiffness 170 and damping 26, driven by drag, wheel, arrows or autoplay. useReducedMotion swaps the spring for a 200ms tween, removes blur and brightness depth, and disables autoplay.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

