klyv-ui

Scratch Card

Component

About

A canvas-based cover a user scratches away with the pointer to reveal content underneath, like a cashback reward or referral code, with a visible button fallback for non-pointer users.

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

Code

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

Usage.tsx

import ScratchCard from "@/components/ui/scratch-card";

export default function ScratchCardDemo() {
  return (
    <div className="flex min-h-[360px] w-full items-center justify-center p-8">
      <div className="w-full max-w-sm">
        <ScratchCard revealLabel="Reveal without scratching">
          <div className="flex flex-col gap-1 rounded-[var(--radius-card)] bg-[var(--color-surface)] p-6">
            <p className="text-[22px] font-extrabold tracking-[-0.02em] text-[var(--color-ink)]">
              $25 cashback
            </p>
            <p className="text-[13px] font-bold text-[var(--color-ink-soft)]">
              Credited to your card within 24 hours.
            </p>
          </div>
        </ScratchCard>
      </div>
    </div>
  );
}

More by klyv-ui

View all
  • Gantt Chart

    Gantt Chart

    68
  • Klyv Animated Beam

    Klyv Animated Beam

    55
  • Shader Canvas

    Shader Canvas

    54
  • Pareto Chart

    Pareto Chart

    49
  • Sunburst Chart

    Sunburst Chart

    28
  • Gooey Loader

    Gooey Loader

    26
  • Fluid Canvas

    Fluid Canvas

    26
  • Morphing Text

    Morphing Text

    23