import { Typography3D } from "@/components/3d/typography";
export default function Example() {
return (
<div style={{ height: 320 }}>
<Typography3D
variant="particle"
theme="light"
/>
</div>
);
}
Deps: three, @react-three/fiber, @react-three/drei, framer-motion
Installation
Install the runtime dependencies, then copy the component module (and the shared 3D core when the component uses WebGL).
npm install three @react-three/fiber @react-three/drei framer-motion
# Copy the component module
cp -r src/components/3d/typography <your-project>/src/components/3d/typography
# Copy the shared 3D core
cp -r src/components/3d/core <your-project>/src/components/3d/coreDependencies: three, @react-three/fiber, @react-three/drei, framer-motion
Usage
Every category module exposes one typed component. Pick an implementation with variant and pass props grouped by concern.
import { Typography3D } from "@/components/3d/typography";
export default function Example() {
return (
<div style={{ height: 320 }}>
<Typography3D
variant="particle"
theme="light"
/>
</div>
);
}
React implementation
With every prop set explicitly. The complete, copyable source of src/components/3d/typography/index.tsx is available in the playground’s Source tab.
import { Typography3D } from "@/components/3d/typography";
export default function Example() {
return (
<div style={{ height: 320 }}>
<Typography3D
variant="particle"
theme="amoled"
text="NEXUS"
font="Helvetica"
weight="bold"
depth={0.35}
bevel={0.02}
color="#7777ff"
rotation={0}
speed={1}
light={1}
glow={1}
mouse
cameraMotion={0.3}
transparent={false}
quality="medium"
/>
</div>
);
}
Next.js implementation
WebGL needs the browser. Load the scene through next/dynamic with ssr disabled and a sized placeholder to avoid layout shift.
// app/particle-typography/page.tsx (Next.js App Router)
"use client";
import dynamic from "next/dynamic";
// WebGL must never run on the server — load the scene client-side only.
const Typography3D = dynamic(
() => import("@/components/3d/typography").then((m) => m.Typography3D),
{ ssr: false, loading: () => <div aria-busy="true" style={{ height: 320 }} /> },
);
export default function Page() {
return (
<main>
<div style={{ height: 320 }}>
<Typography3D
variant="particle"
theme="light"
/>
</div>
</main>
);
}
TypeScript interfaces
export type Theme = "light" | "amoled";
export interface ParticleTypographyProps {
/** Which 3D Typography implementation to render */
variant: "particle";
theme: Theme;
/* Content */
text?: string; // default "NEXUS"
/* Visual */
font?: "Helvetica" | "Humanist" | "Serif" | "Mono"; // default "Helvetica"
weight?: "regular" | "bold"; // default "bold"
depth?: number; // 0.05–1.2, default 0.35
bevel?: number; // 0–0.08, default 0.02
color?: string; // default "#7777ff"
/* Camera */
rotation?: number; // -90–90, default 0
cameraMotion?: number; // 0–1, default 0.3
/* Animation */
speed?: number; // 0–3, default 1
/* Lighting */
light?: number; // 0–3, default 1
glow?: number; // 0–3, default 1
/* Interaction */
mouse?: boolean; // default true
/* Rendering */
transparent?: boolean; // default false
quality?: "low" | "medium" | "high"; // default "medium"
}
Props reference
| Prop | Type | Default | Group | Description |
|---|---|---|---|---|
| variant | "particle" | — | Core | Selects the implementation. |
| theme | "light" | "amoled" | — | Core | Themes surfaces, materials and lighting. |
| text | string | "NEXUS" | Content | Text |
| font | "Helvetica" | "Humanist" | "Serif" | "Mono" | "Helvetica" | Visual | Font |
| weight | "regular" | "bold" | "bold" | Visual | Font weight |
| depth | number | 0.35 | Visual | Extrusion depth (0.05 – 1.2) |
| bevel | number | 0.02 | Visual | Bevel (0 – 0.08) |
| color | string (hex) | "#7777ff" | Visual | Color |
| rotation | number | 0 | Camera | Rotation Y (°) (-90 – 90) |
| speed | number | 1 | Animation | Animation speed (0 – 3) |
| light | number | 1 | Lighting | Light intensity (0 – 3) |
| glow | number | 1 | Lighting | Emissive glow (0 – 3) |
| mouse | boolean | true | Interaction | Mouse interaction |
| cameraMotion | number | 0.3 | Camera | Camera movement (0 – 1) |
| transparent | boolean | false | Rendering | Transparent background |
| quality | "low" | "medium" | "high" | "medium" | Rendering | Quality preset |
Customization
Colour props accept any hex string. Content props accept plain strings. Every value shown in the playground maps 1:1 to a prop, so you can design visually and copy the generated code. Use Share to send a pre-configured link or Export to download the configuration JSON.
import { Typography3D } from "@/components/3d/typography";
export default function Example() {
return (
<div style={{ height: 320 }}>
<Typography3D
variant="particle"
theme="light"
color="#ff5a36"
/>
</div>
);
}
Animation settings
- speedAnimation speed · 0–3
- mouseMouse interaction
All motion is suspended when prefers-reduced-motion is on.
Theme support
Pass theme="light" or theme="amoled". Lighting rigs, environment reflections, blending modes and canvas backgrounds change with it — AMOLED uses true #000000 with controlled emissive accents; Light uses soft studio lighting with contact shadows. Use the theme switch in the playground toolbar to preview both.
Responsive behavior
The component fills its parent, so size it with the container. Use the playground’s desktop / tablet / mobile selector to test. Canvas resolution adapts through the adaptive DPR range of the active quality preset.
Accessibility notes
- — WebGL text is exposed through an aria-label that mirrors the string.
- — DOM variants keep real text nodes, so selection and screen readers work.
- — Animated morphing exposes the final word via aria-live.
Performance notes
- — Typeface JSON is fetched once and cached; curve segments scale with quality.
- — Particle typography samples a 2D canvas once and animates in a vertex shader.
- — Prefer short strings — extrusion cost grows with glyph count.
Presets: LOW (DPR 1, no AA, ~35% density) · MEDIUM (DPR ≤1.5, ~70%) · HIGH (DPR ≤2, full density).
Related components
- Distorted TextChrome type that warps more the closer your cursor is to the centre.
- Wave TypographyLetters riding a staggered sine wave.
- Perspective TypographyCSS-3D stacked text with extrusion shadows that follows your pointer.
- Interactive Text SculptureDrag the text to rotate it freely and let it settle back.