Scratch To Reveal

Motion

Scratch To Reveal is a React scratch card with a gradient foil you rub away by pointer or touch to show the content beneath, clearing itself past a set threshold.

src/registry/premium/scratch-to-reveal.tsx/r/scratch-to-reveal.json

Installation#

bash
npx shadcn@latest add @minidev/scratch-to-reveal

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/scratch-to-reveal.json

Usage#

tsx
import { ScratchToReveal } from "@/components/ui/scratch-to-reveal"

export function Example() {
  return <ScratchToReveal />
}

API reference#

ScratchToReveal props
PropTypeDefault
thresholdnumber50
brushnumber24
gradientstring[]DEFAULT_GRADIENT
labelstring"Scratch to reveal"
onComplete() => void-
onProgress(percent: number) => void-
childrenReact.ReactNode-
classNamestring-

Dependencies#

npm

lucide-reactmotion

Built from

No other MiniDev files
All Animated React components