Button - Glitched

A dynamic, animated button with glitch effects powered by GSAP and Framer Motion. Fully customizable with variants, glitch colors, and timing.

The ButtonGlitch is a highly customizable button component with a glitch animation effect.
It supports multiple variants, glitch timing, glitch colors, and standard button props like type, disabled, and onClick.

Live Preview
Open in
Gsap
Framer Motion

Props

PropTypeDefaultDescription
childrenReact.ReactNoderequiredContent inside the button (text, icon, etc.).
classNamestringundefinedTailwind/utility classes to extend or override styles.
onClick(e: React.MouseEvent<HTMLButtonElement>) => voidundefinedFunction called when the button is clicked.
type"button" | "submit" | "reset""button"Button type.
disabledbooleanfalseDisables the button.
glitchbooleantrueEnables or disables the glitch animation.
glitchIntervalnumber3000Interval between glitches in ms.
glitchDurationnumber0.1Duration of each glitch step in seconds.
glitchColors{ primary: string; secondary: string }{ "#ff0000", "#00ffff" }Colors used for glitch shadows and text.
variant"default" | "primary" | "secondary" | "ghost""primary"Predefined style variant for the button.

Default Usage

<ButtonGlitch onClick={() => alert("Glitched!")}>
  Default Glitch
</ButtonGlitch>

Secondary Variant with Custom Colors

<GlitchButton
  variant="secondary"
  glitchColors={{ primary: "#ff00ff", secondary: "#00ffcc" }}
>
  Purple Glitch
</GlitchButton>

Ghost Variant Without Glitch

<GlitchButton glitch={false} variant="ghost">
  No Glitch Ghost
</GlitchButton>

Submit Button With Faster Glitch

<GlitchButton
  type="submit"
  glitchInterval={1500}
  glitchDuration={0.05}
>
  Fast Glitch Submit
</GlitchButton>

Disabled State

<GlitchButton disabled>
  Disabled Glitch
</GlitchButton>

Custom Styles With Tailwind

<GlitchButton className="bg-gradient-to-r from-indigo-500 to-purple-600 border-none">
  Gradient Glitch
</GlitchButton>