Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

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

PropTypeDefaultWhat it does
title"Draft · Q4 notes"Heading printed on the page.
onTrash—Called once the ball has landed in the bin.
onRestore—Called once Undo has smoothed the page flat again.
autoplayfalseThrows the page away and brings it back every 3s until someone clicks the button.
ShatterDelete.fileName"Q3-board-report.pdf"File name on the card.
ShatterDelete.meta"2.4 MB · edited 2 days ago"Secondary line under the name.
ShatterDelete.badge"PDF"Text on the file-type badge.
ShatterDelete.badgeColor"#ff3b30"Colour of the file-type badge.
ShatterDelete.onDelete—Called when the user presses Delete; the component only plays the effect.
ShatterDelete.onUndo—Called when the user presses Undo and the shards fly back together.
ShatterDelete.autoplayfalseShatters and mends the card every 2.3s until someone touches it.
enableSoundtruePlays 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. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 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:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and 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}"
          }
        }
      }

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.