Crumple to Trash, animated React component
- Pro
- Motion Effects
- Spring
Crumple to Trash
A literal Move to trash: the page scrunches into a paper ball, arcs into a bin whose lid flips open and snaps shut, and Undo throws it back out and smooths it flat. Also includes the Motion Kit Shatter Delete variant.
Shatter Delete
Swishes as the page scrunches and thumps when it lands in the bin; the shatter variant knocks as the card cracks; Undo swishes the pieces back. Sound is off on this site until you switch it on.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| title | string | "Draft · Q4 notes" | Heading printed on the page. |
| onTrash | () => void | — | Called once the ball has landed in the bin. |
| onRestore | () => void | — | Called once Undo has smoothed the page flat again. |
| autoplay | boolean | false | Throws the page away and brings it back every 3s until someone clicks the button. |
| ShatterDelete.fileName | string | "Q3-board-report.pdf" | File name on the card. |
| ShatterDelete.meta | string | "2.4 MB · edited 2 days ago" | Secondary line under the name. |
| ShatterDelete.badge | string | "PDF" | Text on the file-type badge. |
| ShatterDelete.badgeColor | string | "#ff3b30" | Colour of the file-type badge. |
| ShatterDelete.onDelete | () => void | — | Called when the user presses Delete; the component only plays the effect. |
| ShatterDelete.onUndo | () => void | — | Called when the user presses Undo and the shards fly back together. |
| ShatterDelete.autoplay | boolean | false | Shatters and mends the card every 2.3s until someone touches it. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Crumple to Trash is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Crumple to Trash works
"Move to trash", literally. The page scrunches into a ball (an SVG displacement filter that ramps up while the sheet shrinks and rounds off), then arcs into the bin, which tips its lid and wobbles. Undo throws it back out and smooths it flat.
The source, the install command and the build prompt come with Pro.
Crumple to Trash questions
Does it make sound, and how do I turn it off?
Swishes as the page scrunches and thumps when it lands in the bin; the shatter variant knocks as the card cracks; Undo swishes the pieces back. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.

