No.519 · Micro-animations
Trash Drop
A delete button that shows where the thing went: the lid tips open, a sheet drops in, the lid shuts and the bin shakes.
The prompt
Written for the variant you picked above: Paper
Build a delete icon button that shows where the thing went. The bin is an outlined SVG: a tapered can with two ribs, a lid with a handle that hinges at its right end, and a small sheet hidden above. On press the lid tips open 32° and lifts a pixel, the sheet drops into the can (translate down 10px, shrinking and fading), the lid shuts with a small overshoot, and the can gives a short shake (−6°, 4°, −2°) — about 620ms in all — and only then the delete callback runs, so the row disappears after the motion explains it. Hover tints the button red. Two identical keyframe sets alternate per press so it replays. Pair it with an undo; the demo is a drafts list with an Undo line. Selected variant — Paper (paper): Apply the paper theme. Where the brief above gives no colour values for it, choose a restrained paper palette with text at 4.5:1 contrast or better. Keep the geometry, states and motion described above unchanged. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click, tap, Space or Enter to delete; the demo offers Undo afterwards. Motion: Lid 620ms; sheet drop 520ms after 80ms; shake 360ms after 400ms; the callback fires at 520ms. Accessibility: Each button is labelled with what it deletes; the demo announces the deletion and offers Undo in a polite live region. Reduced motion deletes without the animation. Responsive behavior: A fixed-size control that sits inline wherever it's placed; nothing depends on screen width. Touch: Works the same on touch; there's no hover-only behaviour. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- Click, tap, Space or Enter to delete; the demo offers Undo afterwards.
- Motion
- Lid 620ms; sheet drop 520ms after 80ms; shake 360ms after 400ms; the callback fires at 520ms.
- Accessibility
- Each button is labelled with what it deletes; the demo announces the deletion and offers Undo in a polite live region. Reduced motion deletes without the animation.
- Responsive
- A fixed-size control that sits inline wherever it's placed; nothing depends on screen width.
- On touch
- Works the same on touch; there's no hover-only behaviour.