Scratch-off

You wonA free month
No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/card-scratch

About this component

A scratch card. Drag across the silver foil (a canvas) to erase it with destination-out strokes while flakes fall from the scratch; once about half is gone the rest dissolves and the prize pops. Keyboard users get a Reveal button, and Scratch again resets it.

Triggers

  • Click
  • Card
  • Fill
  • Mouse tracking

Techniques

  • Event position
  • Keyframes
  • State machine

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

A Reveal button (visible on focus) reveals the prize without scratching, and becomes Scratch again afterwards. The prize text is in the DOM, not the canvas.

Reduced motion

No flakes fall and the prize appears without the pop.

Use it in anything you build, commercial and client work included. Licence

More cards

See all
01Swiss gridDrag me sideways
02BauhausForm follows function
03BrutalismRaw and honest
04MemphisLoud on purpose
Swipe DeckGet code
01PlanSketch the flow
02BuildMake it move
03ShipWatch it land
Field GuideHover to open
Tri-foldGet code
Aurora
Floating light blobs
AuroraGet code
Border Glow
Conic gradient spin
Border GlowGet code