Scratch reveal
A scratch card. Rub the foil with a finger or the mouse and it comes away under the stroke; once enough is gone the rest lifts off and what was underneath settles into place. A Reveal button does the same from the keyboard.
Scratch the foil, or reveal it.
When to use
- Promotions, rewards and referral codes.
- Playful reveals in onboarding or games.
When not to use
- Information people need right away; reveal it plainly.
- Anything that looks like gambling for money.
Installation
pnpm dlx shadcn@latest add @caliper/scratch-reveal
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
ScratchReveal
5 props
Also accepts the native props of its root element and a ref.
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It exposes img semantics, with aria-hidden, aria-label and aria-live kept in step with state. Changes that matter are announced through a live region.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/scratch-reveal.mdThe index of every part is at /llms.txt.