- Docs
- Components
- Text
- Text Cube
A 3D cube of text that follows the cursor
| Name | Type | Default | Description |
|---|---|---|---|
word | string | "x" | Text drawn at every point of the lattice. |
fill | "word" | "letters" | "random" | "word" | How text covers the faces: the whole word at each point, its letters spelled across the faces, or random glyphs from the charset. |
charset | string | "abcdefghijklmnopqrstuvwxyz0123456789" | Glyphs used by the scramble, the shuffle and the random fill. |
upright | boolean | false | Keeps every glyph upright and facing you instead of printing it on its face. |
cubeSize | number | 280 | Edge length of the cube in pixels. It shrinks to fit small containers. |
density | number | 49 | Glyphs per face, rounded up to a square grid. |
fontSize | number | 18 | Glyph size in pixels at the centre of the cube. |
fontWeight | number | 300 | Font weight from 100 to 900. |
fontFamily | string | "inherit" | Font family. Inherit uses the font of the page. |
color | string | "currentColor" | Glyph colour. Defaults to the surrounding text colour. |
accentColor | string | "#B19EEF" | Colour of scrambling glyphs and of the far faces. |
backgroundColor | string | "transparent" | Fill behind the cube. On light fills or light pages the colours turn into deep ink tones. |
shading | number | 0.6 | How much faces dim as they turn away from you. |
depthFade | number | 0.3 | Extra fade toward the back of the cube. |
depthTint | number | 0.5 | How far the back faces shift toward the accent colour. |
glow | number | 0.35 | Soft bloom around bright glyphs. Dark backgrounds only. |
perspective | number | 700 | Camera distance in pixels. Lower values look more dramatic. |
rotationSpeed | number | 1 | Speed of the idle tumble. |
autoRotateX | number | 0.3 | Idle tumble around the horizontal axis. |
autoRotateY | number | 0.3 | Idle tumble around the vertical axis. |
breathe | number | 0.1 | Size of the slow breathing pulse. |
breatheSpeed | number | 2 | Speed of the breathing pulse. |
followSpeed | number | 0.08 | How quickly the cube springs after the cursor. 0 keeps it in place. |
roll | number | 0.35 | How much the cube rolls as it travels. |
offsetX | number | 0 | Horizontal offset from the cursor in pixels. |
offsetY | number | 0 | Vertical offset from the cursor in pixels. |
draggable | boolean | true | Drag to spin the cube. A flick keeps it turning. |
inertia | number | 1 | Seconds a flicked spin takes to slow down. |
scrambleDuration | number | 1.1 | Length of the click scramble in seconds. 0 turns it off. |
shuffle | number | 0 | Glyphs per second that quietly change on their own. |
opacity | number | 1 | Overall opacity. |
interactive | boolean | true | Follow, drag and click. Off keeps the cube centred. |
intro | boolean | true | Types the cube in from the front when it appears. |
paused | boolean | false | Stops the tumble, breathing and shuffle. Reduced-motion users get a still cube. |
dpr | number | 2 | Maximum device pixel ratio for the canvas. |
width | string | number | "100%" | Width of the root. |
height | string | number | "100%" | Height of the root. |
children | ReactNode | undefined | Content drawn above the cube. |
className | string | undefined | Classes for the root element. |
style | CSSProperties | undefined | Inline styles for the root element. |
ref | { scramble, spin } | undefined | scramble() runs the scramble from code. spin(x?, y?) flicks the cube, in radians per second. |
wordstringText drawn at every point of the lattice.
"x"fill"word" | "letters" | "random"How text covers the faces: the whole word at each point, its letters spelled across the faces, or random glyphs from the charset.
"word"charsetstringGlyphs used by the scramble, the shuffle and the random fill.
"abcdefghijklmnopqrstuvwxyz0123456789"uprightbooleanKeeps every glyph upright and facing you instead of printing it on its face.
falsecubeSizenumberEdge length of the cube in pixels. It shrinks to fit small containers.
280densitynumberGlyphs per face, rounded up to a square grid.
49fontSizenumberGlyph size in pixels at the centre of the cube.
18fontWeightnumberFont weight from 100 to 900.
300fontFamilystringFont family. Inherit uses the font of the page.
"inherit"colorstringGlyph colour. Defaults to the surrounding text colour.
"currentColor"accentColorstringColour of scrambling glyphs and of the far faces.
"#B19EEF"backgroundColorstringFill behind the cube. On light fills or light pages the colours turn into deep ink tones.
"transparent"shadingnumberHow much faces dim as they turn away from you.
0.6depthFadenumberExtra fade toward the back of the cube.
0.3depthTintnumberHow far the back faces shift toward the accent colour.
0.5glownumberSoft bloom around bright glyphs. Dark backgrounds only.
0.35perspectivenumberCamera distance in pixels. Lower values look more dramatic.
700rotationSpeednumberSpeed of the idle tumble.
1autoRotateXnumberIdle tumble around the horizontal axis.
0.3autoRotateYnumberIdle tumble around the vertical axis.
0.3breathenumberSize of the slow breathing pulse.
0.1breatheSpeednumberSpeed of the breathing pulse.
2followSpeednumberHow quickly the cube springs after the cursor. 0 keeps it in place.
0.08rollnumberHow much the cube rolls as it travels.
0.35offsetXnumberHorizontal offset from the cursor in pixels.
0offsetYnumberVertical offset from the cursor in pixels.
0draggablebooleanDrag to spin the cube. A flick keeps it turning.
trueinertianumberSeconds a flicked spin takes to slow down.
1scrambleDurationnumberLength of the click scramble in seconds. 0 turns it off.
1.1shufflenumberGlyphs per second that quietly change on their own.
0opacitynumberOverall opacity.
1interactivebooleanFollow, drag and click. Off keeps the cube centred.
trueintrobooleanTypes the cube in from the front when it appears.
truepausedbooleanStops the tumble, breathing and shuffle. Reduced-motion users get a still cube.
falsedprnumberMaximum device pixel ratio for the canvas.
2widthstring | numberWidth of the root.
"100%"heightstring | numberHeight of the root.
"100%"childrenReactNodeContent drawn above the cube.
undefinedclassNamestringClasses for the root element.
undefinedstyleCSSPropertiesInline styles for the root element.
undefinedref{ scramble, spin }scramble() runs the scramble from code. spin(x?, y?) flicks the cube, in radians per second.
undefined