Components / Layout
3D Carousel
A ring of cards spinning in 3D space. Hover to pause, drag to spin.
01
02
03
04
05
06
07
08
Installation
Requires React 18+ and Tailwind CSS.
- 1
Install dependencies
$ npm install motion - 2
Add the component
Copy the code from the Code tab above into
components/ui/carousel-3d.tsx. - 3
Use it
example.tsximport { Carousel3D } from "@/components/ui/carousel-3d"; const gradients = [ "from-orange-400 to-rose-500", "from-cyan-400 to-blue-600", "from-lime-400 to-emerald-600", "from-fuchsia-400 to-purple-600", "from-yellow-300 to-orange-500", "from-sky-400 to-indigo-600", "from-rose-400 to-red-600", "from-teal-300 to-cyan-600", ]; export default function Carousel3DDemo() { return ( <Carousel3D items={gradients.map((g, i) => ( <div key={g} className={`flex h-full w-full items-end rounded-2xl bg-gradient-to-br ${g} p-3 text-sm font-semibold text-white shadow-xl`} > 0{i + 1} </div> ))} /> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | ReactNode[] | — | Cards around the ring. |
| radius | number | 230 | Ring radius (px). |
| itemWidth | number | 130 | Card width (px). |
| itemHeight | number | 180 | Card height (px). |
| duration | number | 24 | Seconds per full turn. |