# Stickers: Peeling and moving

> How a sticker peels, comes off, is picked up and stuck down, and how to keep where it's been put.

Source: https://cesarvenzac.com/stickers/docs/peeling-and-moving

A sticker is peeled by an edge: pressed near one, the sheet rolls up round a cylinder from that point, its back showing, and the point you hold stays under the pointer. Pointed at, an edge offers a hand. Let go before half of it is lifted and it lies back down on a spring.

## Coming off

Past half way (`comesOff`, a share from 0 to 1), it comes off. A sticker that can't be moved peels the rest of the way and goes: `onPeel` is called, and `restore()` puts it back, pressed down where it was.

```tsx
<Sticker
  src={bolt}
  onPeel={() => setOff(true)}
  handle={(sticker) => (ref.current = sticker)}
/>;

ref.current?.restore();
```

`peelOff()` peels it away from a corner, as a hand would.

## Picked up

With `drag`, a sticker that comes off is in your hand, and a press anywhere else on it picks it up. It lifts toward you, its shadow growing, and follows the point you hold it by, swinging round behind it as a card dragged across a table does, tilting as it goes. Let go and it's pressed down where it is, turned as it was.

```tsx
<div className="relative h-96">
  <Sticker src={star} drag onDrop={(place) => save(place)} />
</div>
```

It moves with `translate` and `rotate`, so a `transform` of your own stays yours. Its middle stays inside its parent's box unless `bounds` names another element, or `null` lets it go anywhere. The one picked up comes to the top of its siblings.

## Where it sits

`onDrop` is told where it now sits: moved `x` and `y` pixels from where the page laid it out, turned `angle` radians. Give it back as `place` to put it there again.

```tsx
<Sticker src={star} drag place={{ x: 40, y: -12, angle: 0.2 }} />
```

## Keys and less motion

- A sticker that can be moved or peeled is focusable. The arrow keys move one with `drag` (Shift for further), lifting it as they do; Enter or Space peels off one that can't be moved.
- Under reduced motion, or with `reducedMotion`, nothing swings, tilts or bounces: a peel lies straight back down, a held sticker follows without turning.
- `label` is what assistive tech reads: a sticker is an image.

## 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.
