Components

Glitch Text

A React glitch text effect for cyberpunk and hacker designs: RGB-split copies of your text jump around in clipped horizontal slices for a short burst — on hover, on a loop or once when scrolled into view. The text stays real, selectable and accessible. Built with Tailwind CSS and Motion.

  • RGB split + clip-path slices
  • Hover, loop or in-view
  • Selectable text
  • No strobing
  • prefers-reduced-motion

Signal lost

Installation

$ npx shadcn@latest add https://duskui.com/r/glitch-text.json

Usage

hero-title.tsx
import { GlitchText } from "@/components/dusk/hacker/glitch-text"

export function HeroTitle() {
  return (
    <GlitchText as="h1" trigger="loop" className="text-6xl font-black">
      System Breach
    </GlitchText>
  )
}

Examples

On hover

The default trigger="hover" glitches on pointer enter, and on keyboard focus when the text wraps a link. It works inline inside a paragraph; intensity sets how far the layers jump.

Hover the words access denied or kernel panic to glitch them. The text stays selectable.

Once in view

trigger="inView" plays a single burst the first time the text scrolls into view. Pick any two colors for the split and a longer duration for drama.

Connection interrupted

API Reference

Also accepts any HTML attribute. Font, size and color are regular classes.

PropTypeDefaultDescription
childrenReactNode—The text. It's rendered three times, so keep it to text and inline formatting.
as"span" | "p" | "div" | "strong" | "h1"–"h6""span"Element to render.
trigger"hover" | "loop" | "inView""hover"What starts a glitch burst.
intervalnumber3200Milliseconds between bursts in loop mode (minimum 1000).
durationnumber450Length of one burst, in ms.
intensitynumber3Maximum horizontal offset of the color layers, in px.
colors[string, string]["#ff2bd6", "#00e5ff"]Colors of the two split layers.
disabledbooleanfalseStop all glitching.

Accessibility

  • The real text is a normal element — selectable, translatable and read once by screen readers. The two colored copies are aria-hidden and ignore the pointer.
  • Bursts are throttled to at most one per second and the layers stay on for the whole burst, keeping it far below the 3-flashes-per-second limit.
  • Loop mode pauses while the text is off-screen or the tab is hidden.
  • With prefers-reduced-motion the text never glitches.
  • Use a heading tag through as for titles so the document outline stays correct.