Components

Cyber Button

A cyberpunk React button with angled clip-path corners and a hacker-style text scramble on hover: the label cycles through random characters, then resolves — or glitches with an RGB split. Built on the DuskUI Button with Tailwind CSS and Motion, so variants, sizes and the width-stable loading state all keep working.

  • Built on DuskUI Button
  • Text scramble or glitch
  • clip-path corners
  • Width-stable
  • prefers-reduced-motion

Installation

$ npx shadcn@latest add https://duskui.com/r/cyber-button.json

Installs the DuskUI Button too. Like the base Button it accepts every native <button> prop, except asChild.

Usage

cta.tsx
import { CyberButton } from "@/components/dusk/hacker/cyber-button"

export function Cta() {
  return <CyberButton size="lg">Jack in</CyberButton>
}

Examples

Glitch effect

effect="glitch" splits the label into magenta and cyan slices instead of scrambling it. Use effect="none" for just the shape.

Corners & cut size

corners picks which corners are cut and cut sets the size in px. The outline variant draws its border along the diagonal cuts too.

Loading

loading and loadingText come straight from the base Button — the width stays put and focus is kept. Effects are paused while loading.

API Reference

Accepts every DuskUI Button prop (variant, size, loading, loadingText…) except asChild, plus:

PropTypeDefaultDescription
effect"scramble" | "glitch" | "none""scramble"Hover / keyboard-focus effect on the label.
cutnumber10Size of the angled corner cuts, in px.
corners"diagonal" | "reverse" | "all""diagonal"Top-left + bottom-right, top-right + bottom-left, or all four.
durationnumber550Length of the scramble or glitch, in ms.
charactersstring"A–Z 0–9 #%&*+=/<>[]{}"Characters used while scrambling.

Accessibility

  • Screen readers always get the real label: the scrambling copy is aria-hidden and a visually hidden copy of the text names the button.
  • The real text reserves the width, so scrambling never changes the button's size.
  • clip-path would cut off a normal focus ring, so keyboard focus shows an inset outline instead; keyboard focus also plays the effect.
  • Effects run at most once per second, repaint characters about 20 times a second without flashing, and are skipped under prefers-reduced-motion.
  • Loading keeps focus via aria-disabled + aria-busy, inherited from the base Button.