Wensity Labs

Text Glitch

Text 13

About

A CSS only glitch text effect with RGB channel split and clip path slices. GPU friendly and reduced motion safe, ideal for gaming, tech and cyberpunk headlines.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Text Glitch to your project and fits it to your theme.

Code

How Text Glitch is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { TextGlitch } from "@/components/ui/text-glitch";

import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

type GlitchTrigger = "always" | "hover";

const THEME_AUTO = "theme";

const settings = {
  text: "wensity",
  duration: 2.4,
  offset: 5,
  enableShadows: true,
  trigger: "always",
  leftColor: THEME_AUTO,
  rightColor: THEME_AUTO,
};

function PreviewShell({
  children,
  className,
}: {
  children: React.ReactNode;
  className?: string;
}) {
  return (
    <div
      className={cn(
        "flex w-full items-center justify-center overflow-visible px-4 py-10 sm:px-8",
        className,
      )}
    >
      {children}
    </div>
  );
}

function Headline({
  text,
  duration,
  offset,
  enableShadows,
  trigger,
  leftColor,
  rightColor,
  compact,
}: {
  text: string;
  duration: number;
  offset: number;
  enableShadows: boolean;
  trigger: GlitchTrigger;
  leftColor: string;
  rightColor: string;
  compact?: boolean;
}) {
  return (
    <TextGlitch
      as="h1"
      text={text || "wensity"}
      duration={duration}
      offset={offset}
      enableShadows={enableShadows}
      trigger={trigger}
      leftColor={leftColor === THEME_AUTO ? undefined : leftColor}
      rightColor={rightColor === THEME_AUTO ? undefined : rightColor}
      className={cn(
        "font-display font-black tracking-tight text-neutral-900 dark:text-white",
        compact
          ? "text-5xl sm:text-6xl"
          : "text-[clamp(2.5rem,12vw,7rem)]",
      )}
    />
  );
}

export function TextGlitchPreview(props: Partial<typeof settings> = {}) {
  const state = { ...settings, ...props };

  return (
    <PreviewShell className="min-h-[360px]">
      <Headline
        text={state.text}
        duration={state.duration}
        offset={state.offset}
        enableShadows={state.enableShadows}
        trigger={state.trigger}
        leftColor={state.leftColor}
        rightColor={state.rightColor}
      />
    </PreviewShell>
  );
}

export default function Demo(props: Partial<typeof settings>) {
  return <TextGlitchPreview {...props} />;
}

Dependencies

More by Wensity Labs

View all
  • Sidebar

    Sidebar

    392
  • Calendar

    Calendar

    287
  • Button

    Button

    131
  • Color Picker

    Color Picker

    97
  • Image Comparison Slider

    Image Comparison Slider

    82
  • AI Prompt Input

    AI Prompt Input

    80
  • Text Morphing

    Text Morphing

    60
  • Carousel

    Carousel

    57

More in Text

View all
  • Motion Blur Text

    Motion Blur Text

    45
  • Rainbow Text Effect

    Rainbow Text Effect

    58
  • Text Reveal

    Text Reveal

    29
  • Blur Reveal

    Blur Reveal

    73
  • Short Slide Down

    Short Slide Down

    45
  • Apple Hello Effect

    Apple Hello Effect

    659
  • Scroll Fill Headline

    Scroll Fill Headline

    14
  • Blur Reveal

    Blur Reveal

    364