RevealButton

A button that reveals a hidden secret value on hold or toggle, with a blur-in animation and an eye icon indicator.

Preview

Props

Variants

Toggle mode

Click once to reveal, click again to hide.

Light

variant="light" swaps the dark face for a white one with a soft gray rim.

Install

npx shadcn@latest add @evilbuttons/reveal-button

Usage

import { RevealButton } from "@/components/evil-buttons/reveal-button";

export function ButtonDemo() {
  return (
    <RevealButton
      secret="sk_live_abc123_xQ4z9"
      maskedValue="sk_live_•••••••"
      revealMode="hold"
      onRevealChange={(revealed) => console.log(revealed)}
    />
  );
}

Props

The component spreads any <button> HTML attributes except children.

PropTypeDefaultDescription
secretReact.ReactNode"sk_live_••••_9xQ4"The real value shown when revealed.
maskedValuestring"•••• •••• ••••"The placeholder string shown when hidden.
labelReact.ReactNode"Reveal"Small label shown above the value when revealed.
hiddenLabelReact.ReactNode"Hidden"Small label shown above the value when hidden.
revealMode"hold" | "toggle""hold"How the button reveals the secret. "hold" requires sustained press; "toggle" switches on each click.
variant"dark" | "light""dark"Graded surface style.
onRevealChange(revealed: boolean) => void-Callback fired whenever the revealed state changes.
classNamestring-Extra classes passed to the button.

Good to know

  • In hold mode, letting go or blurring hides it again.
  • aria-pressed reflects whether it's revealed.

Search docs

Jump to a button documentation page