Components / Text
Glitch Text
Cyberpunk-style text with RGB-split slices that glitch on a loop or on hover.
SYSTEM FAILURE
Or only on hover: hover me
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/glitch-text.tsx. - 3
Use it
example.tsximport { GlitchText } from "@/components/ui/glitch-text"; export default function GlitchTextDemo() { return ( <div className="space-y-4 text-center"> <GlitchText text="SYSTEM FAILURE" className="text-4xl font-black tracking-tight text-zinc-900 dark:text-white sm:text-5xl" /> <p className="text-sm text-zinc-600 dark:text-zinc-400"> Or only on hover:{" "} <GlitchText text="hover me" hoverOnly intensity={3} className="font-semibold text-zinc-900 dark:text-white" /> </p> </div> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | — | The text to glitch. |
| intensity | number | 6 | Max offset of the color layers (px). |
| hoverOnly | boolean | false | Only glitch while hovered. |