Join our Discord Community

React Glitch Text

Cyberpunk-style glitchy text effect with customizable speed and shadows. Perfect for React applications requiring digital distortion animations.

Trying to implement glitch text effects?

Join our Discord community for help from other developers.


Most text effects are subtle and boring—basic animations that don't capture attention or convey digital energy. This component creates authentic glitch effects with randomly clipping text fragments, RGB color separation, and distorted shadows that simulate digital corruption and screen interference.

Cyberpunk glitch text with RGB shadows

Text with authentic digital glitch effects and color separation:

Loading component...

Built with TypeScript and CSS animations for React applications, using clip-path masking and pseudo-elements. The effect creates multiple text layers with different offsets and shadow colors, animated with randomized clipping patterns to simulate screen glitches.

Installation

npx shadcn@latest add https://www.shadcn.io/registry/glitch-text.json
npx shadcn@latest add https://www.shadcn.io/registry/glitch-text.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/glitch-text.json
bunx shadcn@latest add https://www.shadcn.io/registry/glitch-text.json

Usage

import GlitchText from "@/components/text/glitch-text";

<GlitchText
  speed={1}
  enableShadows={true}
  enableOnHover={true}
  className="text-center"
>
  Cyberpunk Text
</GlitchText>

Why most glitch effects fail

Most developers use simple transforms or opacity changes—predictable effects that don't capture the chaotic nature of digital corruption. Real glitches are unpredictable, fragmented, and multi-layered, involving color separation, timing variations, and spatial distortion.

This React component uses CSS clip-path with randomized inset values to create authentic fragmentation. The pseudo-elements create offset copies with red and cyan shadows, simulating RGB color separation common in digital interference. The animation timing is intentionally irregular to avoid mechanical repetition.

The key insight: authentic glitches are chaotic. When text fragments appear and disappear at different positions with color bleeding, it creates the visual language of digital malfunction that users recognize from cyberpunk aesthetics and screen corruption.

Features

  • Authentic glitch animation with randomized clip-path fragmentation and RGB color separation
  • Configurable animation speed with independent timing for before/after pseudo-elements
  • Optional hover-triggered glitches for interactive text effects and user engagement
  • Customizable shadow colors with red/cyan color separation for authentic RGB bleeding
  • Performance optimized with pure CSS animations and hardware-accelerated transforms
  • Theme-aware styling with CSS custom properties for foreground and background colors
  • Free open source component compatible with Next.js and shadcn/ui design systems

API Reference

GlitchText

Glitch text component with customizable distortion effects.

PropTypeDefaultDescription
childrenstringrequiredText content to apply glitch effect
speednumber0.5Animation speed multiplier
enableShadowsbooleantrueEnable RGB color separation shadows
enableOnHoverbooleanfalseTrigger glitch effect only on hover
classNamestring-Additional CSS classes

Speed Configuration

Control animation intensity with speed settings:

Speed ValueEffect DurationVisual Impact
0.2Very slow (6s/4s)Subtle, atmospheric
0.5Moderate (3s/2s)Balanced visibility
1.0Fast (1.5s/1s)High energy, attention-grabbing
2.0Very fast (0.75s/0.5s)Intense, rapid glitching

Shadow Options

RGB color separation effects:

SettingRed ShadowCyan ShadowEffect
Enabled-5px offset+5px offsetFull RGB separation
DisabledNoneNoneClean fragmentation only

Common gotchas

Animation doesn't show: Ensure the Tailwind config includes the glitch keyframes and animation classes. The component requires custom CSS animations that may not be included in default Tailwind configurations.

Text appears cut off: The glitch effect uses large text sizing with clamp() for responsive scaling. Ensure the container has sufficient space and the text length is reasonable for the display area.

Shadows don't match theme: The component uses hardcoded red and cyan shadows for authentic RGB separation. For theme integration, you might want to customize the shadow colors using CSS custom properties.

Performance on mobile: CSS clip-path animations can be intensive on older devices. The component uses hardware acceleration, but consider using enableOnHover for mobile to reduce constant animation load.

Hover state issues: When enableOnHover is true, the pseudo-elements are initially hidden and only appear on hover. Ensure proper hover states are set up and consider touch device behavior for mobile interfaces.

Integration with other components

Perfect for hero sections in cyberpunk-themed Card layouts or attention-grabbing headings in Dialog modals. Works excellently with dark themes and neon color schemes for gaming or tech-focused applications.

For branding interfaces, combine with Badge components for status indicators or Button components with matching glitch aesthetics. The component pairs well with Progress bars for loading states and Alert components for system status messages in tech-themed interfaces.

Questions developers actually ask