3D & WebGLNew

Box Carousel

Slides sit on the faces of a 3D cube that turns to the next one. Flip with buttons, by dragging or automatically.

Customize

faceColor
edgeColor

Based on Box Carousel (MIT license) · Terms of use

More in Pro

View all

Props

18 properties
PropertyTypeDefaultDescription
items{ id: string; type: 'image' | 'video'; src: string; alt?: string; poster?: string }[]—Slides: images or videos.
widthnumber280Cube width, in pixels.
heightnumber200Cube height, in pixels.
direction'top' | 'bottom' | 'left' | 'right'"left"Which way the cube turns.
perspectivenumber600Perspective depth: lower means stronger 3D.
autoPlaybooleanfalseFlip slides automatically.
autoPlayIntervalnumber3000Pause between automatic turns, in milliseconds.
enableDragbooleantrueAllow turning by dragging.
dragSensitivitynumber0.5How much the cube turns per dragged pixel.
transitionValueAnimationOptions"{ duration: 1.25, ease: [0.953, 0.001, 0.019, 0.995] }"Turn animation for next and prev.
snapTransitionValueAnimationOptions"{ type: 'spring', damping: 30, stiffness: 200 }"How the cube settles after a drag.
dragSpring{ stiffness?: number; damping?: number; mass?: number }"{ stiffness: 200, damping: 30 }"Spring while dragging.
debugbooleanfalseHighlight the cube faces for debugging.
onIndexChange(index: number) => void—Called when the slide changes.
ref{ next(): void; prev(): void; getCurrentItemIndex(): number }—Control the carousel from code.
faceColorstring"#171717"Background of the cube faces, seen behind transparent or loading media.
edgeColorstring"rgba(255, 255, 255, 0.1)"Thin edge drawn around each face.
classNamestring—Extra classes.

Dependencies

3 required packages

npm install motion clsx tailwind-merge

Related components

View all