For Tailwind CSS v3 docs, click here.

Scratch To Reveal

The ScratchToReveal component creates an interactive scratch-off effect with customizable dimensions and animations, revealing hidden content beneath.

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/scratch-to-reveal.json"

手动安装

复制并粘贴以下代码:

ScratchToReveal.vue

API

Prop 名称类型默认值描述
classstring""The class name to apply to the component.
widthnumber""Width of the scratch container.
heightnumber""Height of the scratch container.
minScratchPercentagenumber50Minimum percentage of scratched area to be considered as completed (Value between 0 and 100).
gradientColors[string,string,string]-Gradient colors for the scratch effect.
Event NamePayload描述
complete-Callback function called when scratch is completed
Slot Name默认值 Content描述
default-The text below the scratch-off ticket.

Component Code

You can 复制并粘贴以下代码: to create this component:

ScratchToReveal.vue

感谢