# Stickers: Scratch cards

> A coating in any finish over whatever an element holds, scratched off with a coin's ragged edge.

Source: https://cesarvenzac.com/stickers/docs/scratch-cards

`scratch` coats an element, whatever it holds, for scratching off. The coating is a finish (`steel`, a scratch card's silver, unless said) in `coat`'s colour, with `print` written on it, and its corners are the element's own.

```tsx
import { Scratch } from "@cesarvenzac/stickers/react";

<Scratch
  print="Scratch here"
  onReveal={() => setWon(true)}
  className="grid h-40 w-72 place-items-center rounded-xl"
>
  You won
</Scratch>;
```

The pointer scratches where it goes, `brush` pixels wide, with a coin's ragged edge; flakes of coating fall as it goes, and the coating's edge casts a hair of shadow on what it uncovers. `onScratch` is told the share scratched so far. Past `revealAt` (half, unless said; 1 never), the rest crumbles away, and `onReveal` is called.

## Without React

```typescript
import { scratch } from "@cesarvenzac/stickers";

const card = scratch(element, { finish: "holo", revealAt: 0.6 });
card.reveal(); // all at once
card.reset(); // coated again
```

## For everyone

Until it's revealed, the card is a button named by `label`, and what's under the coating isn't read; Enter or Space reveals it. Under reduced motion no flakes fall and it's revealed at once.

## Stickers's docs

- [Overview](https://cesarvenzac.com/stickers.md): Stickers for the web: die-cut from any picture, peeled, picked up and stuck down, lit by the pointer.
- [Getting started](https://cesarvenzac.com/stickers/docs/getting-started.md): Install Stickers and make a picture a sticker: in React, or on any element.
- [Peeling and moving](https://cesarvenzac.com/stickers/docs/peeling-and-moving.md): How a sticker peels, comes off, is picked up and stuck down, and how to keep where it's been put.
- [Finishes and the light](https://cesarvenzac.com/stickers/docs/finishes.md): Paper, gloss, holographic foil in five patterns, glitter and glow in the dark: how each takes the light.
- [API reference](https://cesarvenzac.com/stickers/docs/api.md): Every function, option and type, as the package exports them.
- [Scratch cards](https://cesarvenzac.com/stickers/docs/scratch-cards.md): A coating in any finish over whatever an element holds, scratched off with a coin's ragged edge.
