shadcn.io is not affiliated with official shadcn/ui
A four-dimensional cube turning through itself behind your content: 16 corners and 32 edges rotated in two planes of 4D space at once and projected down, so its inner cube keeps flowing out to become the outer one. The large one is sized past the box, so its outer edges cross the frame; two smaller, fainter ones turn more slowly further back. Nearer edges are brighter and thicker, far ones fade, and a soft glint marks each corner as it comes close. A small canvas redraws the 96 edges each frame, and runs only while it's on screen.
Use it on science, crypto and developer-tool pages, behind a headline. For a turning globe of dots use Sphere; for isometric cubes, Boxes; for a perspective tunnel, Portal.
Installation
Usage
import { Tesseract } from "@/components/ui/tesseract";<Tesseract className="flex min-h-[480px] items-center justify-center">
<h1 className="text-4xl font-semibold">Think in four dimensions</h1>
</Tesseract>Tesseract is a container: whatever you put inside sits on top, in normal flow. The figures fill the whole box and fade toward its edges (fade); there's no painted panel, so your page's background shows through, and the lines take your text colour. For a backdrop behind the whole page, render it empty with className="fixed inset-0 -z-10".
Demos
Glow
A light cyan (color="oklch(0.865 0.127 207.078)") on a dark card, where the corner glints read like a lit wireframe; speed={0.6} slows the turn.
Large
count={1} leaves just the large hypercube, scale={1.4} makes it bigger still, so most of its outer cube runs past the edges, and speed={0.5} halves the pace.
Accessibility
The canvas is decorative: it's hidden from screen readers and never takes the pointer, and your content stays on top in normal flow. With reduced motion it draws one still frame of the figures. Nothing flashes: the corner glints brighten and dim slowly as the corners come and go. The lines are thin and mostly faint, and they fade toward the edges, so a headline in your foreground colour stays readable over them; with a bright color, keep body text on a soft panel.
FAQ
What is drawn?
A hypercube: 16 corners at (±1, ±1, ±1, ±1) joined by 32 edges, turned in the XW and YZ planes (and a little ZW), put through a four-dimensional perspective and then a three-dimensional one, seen from a three-quarter view. That's why the inner cube grows into the outer one as it turns.
How does it show depth?
Each edge is cut in three and every piece is drawn at the strength and width of its depth, in eight steps: the near ones bright and thick, the far ones thin and faint. The two smaller hypercubes are fainter and slower still, so they sit further back.
Does it cost much?
About 0.2 milliseconds of script a frame for a full-width hero: 96 edges in eight strokes and 48 glints stamped from one cached image. The loop stops when the background scrolls out of view, and the browser pauses it in a hidden tab.
How do I change the speed?
Pass speed, a multiplier: 1 is a full turn through the fourth dimension about every 40 seconds, 0.5 half as fast, 2 twice as fast.
How do I change the size or the number of figures?
scale sizes the large hypercube: 1 runs its outer cube past the edges, 0.6 keeps it inside. count is how many turn, from 1 to 3: the large one, then the two smaller ones.
API Reference
Tesseract
<div> data-slot="tesseract"
color?string
The lines' and glints' colour, any CSS colour. @default "var(--foreground)".
count?number
How many hypercubes turn: the large one, then up to two smaller, fainter ones further back. From 1 to 3.
- Default
3
fade?"none" | "radial" | "top" | "bottom"
Where the figure fades out: toward every edge (radial), toward the
top, toward the bottom, or not at all. It's a mask, so it fades into
whatever is behind.
- Type
"none" | "radial" | "top" | "bottom"- Default
"radial"
glow?boolean
A soft glint on each corner, brighter as it comes near. @default true.
- Default
true
scale?number
The large hypercube's size: 1 runs its outer cube past the box's edges, 0.6 keeps it inside.
- Default
1
speed?number
How fast it turns: 1 is a full turn through the fourth dimension about every 40 seconds, 0.5 half as fast, 2 twice as fast.
- Default
1
render?ReactElement | ((props: object, state: object) => ReactElement)
Replace the host element or compose it with another component.
- Type
ReactElement | ((props: object, state: object) => ReactElement)
className?string
Merged with the part's classes.
--tesseract-colorstring
The lines' and glints' colour (--foreground).
Related
- Pro


Sphere Background
GenerativeAnother rotating 3D figure
- Pro


Boxes Background
GridsIsometric cubes
- Pro


Portal Background
LightA perspective tunnel
- Pro


Blueprint Background
GridsTechnical line drawing
- Pro


Facets Background
GenerativeA low-poly surface of triangles
- Pro


Warp Background
TechHyperspace lines