Scratch Reveal, animated React component
A reward scratch card: rub the silver foil and it wears through where you scratch, shedding dust that falls out of the card. Once enough is gone the rest lifts away with a burst of confetti and the code can be copied to the clipboard.
- Pro
- Cards
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
You won20% off Pro
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| code | string | "MOTION20" | The code under the foil; the Copy button writes it to the clipboard. |
| headline | string | "20% off Pro" | Prize line above the code. |
| eyebrow | string | "You won" | Small uppercase line above the headline. |
| accent | string | "#bf5af2" | Colour of the eyebrow. |
| threshold | number | 0.55 | Share of the foil (0 to 1) that must be scratched before the rest lifts away. |
| onReveal | () => void | — | Called each time the foil comes off. |
| onCopy | (code: string) => void | — | Called with the code after it has been copied. |
| className | string | — | Extra classes for the outer wrapper. |
| autoplay | boolean | false | Scratches the card, reveals it and starts over until someone touches it. |