# Tear-Off Sticker

> Peel a sticker by its corner to see what is under it.

Grab the corner and drag: the sticker folds back along a true crease, its underside showing, and comes away past the threshold. For reveals, gift cards, 'new' badges and onboarding.

- Family: Originals
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/tear-off/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add tear-off
```

It installs to `components/galactrex/tear-off.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { TearOff } from "@/components/galactrex/tear-off";

<TearOff sticker={<Sticker />} onPeel={reveal}>
  <Reward />
</TearOff>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | What the sticker hides. |
| `sticker` | `ReactNode` | — | The sticker's face. |
| `threshold` | `number` | `0.55` | Share of the diagonal before it comes off. |
| `onPeel` | `() => void` | — | Called once when peeled off. |
| `label` | `string` | `"Peel the sticker"` | Name of the peel action. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Gift.** A code or a message underneath.
- **Badge.** A small sticker on a card that peels to show details.

## Accessibility

- The sticker is a button: Enter or Space peels it in one go.

## Motion

- The crease is the perpendicular bisector of corner and pointer; face and flap are clip-path polygons.
- Reduced motion: it comes off instantly.
