Skip to content
VenusUI
Get started

3D Cube

A CSS-only cube with six content faces that tumbles slowly and pauses on hover.

Preview

Installation

npx shadcn@latest add @venusui/cube-3d

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/cube-3d.tsx

Usage

The code behind the preview above.

cube-3d-demo.tsx

import { Cube3d } from "@/components/ui/cube-3d"

export default function Cube3dDemo() {
  return <Cube3d faces={["Design", "Build", "Test", "Ship", "Learn", "Repeat"]} />
}

API reference

PropTypeDefaultDescription
facesReactNode[]—Up to six faces: front, right, back, left, top, bottom. Required.
sizenumber160Edge length in pixels.
durationnumber14Seconds per full turn.

All <div> props except children.

Requirements

  • Tailwind CSS v4. The CLI adds the cube-3d keyframes and --animate-cube-3d. No JavaScript; works in Server Components.

Customization

  • Put icons, logos or images on the faces.
  • Faces use the card colors; restyle them in the file.

Accessibility

  • Face content is in the page in order, so screen readers read all six faces.
  • With reduced motion it rests at an angle that shows three faces.

Troubleshooting

The cube looks flat.
A parent with overflow: hidden and transform can flatten 3D. Keep the cube’s own wrapper free of transforms.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A tilted wall of vertically scrolling columns, for screenshots and showcases.

Loading preview

A WebGL field of points rolling like a wave, for hero and section backgrounds.

Loading preview

A large screen, tipped back in 3D, that swings upright as it scrolls into view.