Depth Carousel 3D
An infinite 3D image carousel in plain DOM and CSS 3D transforms — no canvas, no WebGL. The active card sits centred, larger and flat; neighbours fan out smaller, rotated, and pushed back in Z, swinging edge-on and disappearing. Frosted-glass edge blur, drag, swipe, wheel, keyboard, click-to-focus and optional autoplay are built in.
Installation#
pnpm dlx shadcn@latest add @davinciui/depth-carousel-3dUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
itemsSlides in the deck. Fewer than 20 render enough clones to tile seamlessly; items without an image show a generated gradient placeholder. | DepthCarousel3DItem[] | — |
ariaLabelAccessible label for the carousel region. | string | "3D image carousel" |
itemWidthSide-card width in pixels; the active card scales up. | number | 300 |
itemHeightSide-card height in pixels; the active card scales up. | number | 250 |
activeWidthScaleActive card width multiplier. | number | 1.5 |
activeHeightScaleActive card height multiplier. | number | 1.2 |
gapSpace between cards in pixels before overlap. | number | 40 |
spacingOverlapMultiplier on (itemWidth + gap) for per-slot spacing; lower values pack cards tighter. | number | 0.85 |
radiusCard corner radius in pixels. | number | 18 |
responsiveScaleScale item sizes by container width (clamped between 0.55 and 1 at 1000px+). | boolean | true |
perspectiveCSS perspective on the root in pixels. | number | 550 |
rotationY rotation per slot in degrees. | number | 35 |
maxRotationRotation cap in degrees; 90 swings far cards edge-on. | number | 90 |
depthZ push per slot in pixels. | number | 200 |
edgeBlurFrosted-glass blur at the outer edges, fading out toward the centre. | boolean | true |
blurAmountbackdrop-filter blur radius in pixels. | number | 25 |
blurWidthWidth of each frosted edge band in percent. | number | 25 |
stiffnessSpring stiffness for slot motion. | number | 170 |
dampingSpring damping for slot motion (labeled “Scroll damping” in the panel). | number | 26 |
massSpring mass for slot motion. | number | 1 |
dragPxPerSlotPixels of drag that advance one slot. | number | 300 |
wheelHorizontal wheel (Shift + vertical works too); plain vertical scroll is never hijacked. | boolean | true |
wheelAxisWhich wheel axes drive the deck. | "horizontal" | "both" | "horizontal" |
keyboardArrow keys move one slot; Home/End jump to the first/last slot. | boolean | true |
clickToFocusClicking a side card springs it to the centre. The active card opens its link instead, if it has one. | boolean | true |
autoplayAdvance one slot on an interval; pauses on hover and after interaction. Reduced motion disables it. | boolean | false |
autoplayIntervalSeconds between autoplay advances. | number | 3 |
minLoopCountMinimum virtual slides in the loop; clones repeat evenly. | number | 20 |
Accessibility#
The root is a labelled region with aria-roledescription='carousel'; each virtual slide is role='group' labelled 'n of N', and aria-hidden is set on every non-active slide as you navigate. The drag layer is focusable with an aria-label ('Drag, swipe, or use arrow keys to browse'); ArrowLeft and ArrowRight move one slot with a spring, Home and End jump to the first and last slot. Clicking a side card springs it to the centre; the active card follows its link in a new tab with noopener (or same tab). Keyboard focus is on the layer, not per-card. Reduced motion replaces springs with a short tween and disables autoplay.
Motion#
Framer Motion springs drive the slot position (default stiffness 170, damping 26, mass 1; 'Scroll damping' maps to damping). Drag sets position directly with per-slot delta and release velocity from the last 100ms; snap targets the nearest slot, capped at a 6-slot throw. Click-to-focus and arrow keys spring along the shortest wrapped path. Column styles are written straight to element refs per frame; no React re-render. Under reduced motion springs become a 0.2s tween and autoplay is disabled; images preload via decode().
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

