Shatter awayNew
One call to discard: the element cracks into shards that kick outward and drop, bottom first.
Used forImage variationsDraftsReview queuesGames and rewards
Install with the shadcn CLI
Registered the namespace? Then it’s shadcn add @hairline/shatter-away. Set it up
Templates
Need the whole page?
61 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 6 are free.
Where it’s used
Image variations
Reject the takes you didn’t pick from a batch of generations.
Drafts
Scrap a draft, a version or a suggestion you won’t use.
Review queues
Reject a submission or a flagged item and see it break up.
Games and rewards
Break a card, a crate or a badge open in a product moment.
What it handles for you
A reject usually looks like a delete, so it carries no sense of the choice you just made.
Pieces, not dust
Grains in a shard share their seeds, so each shard moves as one piece with a hairline crack around it.
One call, any element
shatterAway(element) works on an image, a card or a row; your state and API stay yours.
Bottom first
The lower shards drop first, so the break reads as falling, not exploding.
Undo puts it back
undoAway plays it back: the shards rise and lock into place.
Real colours
Pictures are read pixel by pixel, so the shards are the picture itself.
Pictures from anywhere
Without CORS the element is masked in place and the shards take its own colours.
Overview
For throwing something out rather than deleting it. Call shatterAway on the take, draft or card being rejected: it cracks along a hidden grid into shards of a few dozen grains each, the bottom ones go first, and every shard is kicked outward and then pulled down as one piece, so you see pieces falling, not dust. It suits the moment you reject an option (the generations you didn’t keep, a draft you scrap) where sand would feel too gentle. The promise resolves and you remove it from your state; undoAway puts the shards back.
States
- shattering
- Shards (a 7 × 9 grid, broken up by noise) let go bottom first over the first 58% of the run. Each is kicked up to 32px outward and 12px up, then falls 90 to 170px, fading late. About 1.05s on a picture, 0.6s on a row.
- gone
- The last shard fades. shatterAway resolves true; the element stays hidden in place until you remove it.
- undoing
- undoAway plays it back 30% quicker: the shards rise and lock together.
- reduced motion
- The element fades out and back in, in 160ms.
Usage
Rejecting the takes you didn’t keep
Keep one generation and break up the rest at once, then save the choice.
Props
- shatterAway(element, options?)
- Promise<boolean>
- Shatters the element. Resolves true once it has gone (it stays hidden in place until you remove it), or false if undoAway brought it back first.
- undoAway(element)
- Promise<boolean>
- Puts the shards back and shows the element again. Resolves true once it is back.
- isAway(element)
- boolean
- True while the element is removed or being removed and not brought back.
- options.duration= 1050 (630 on rows)
- number
- Milliseconds for the whole removal.
Accessibility and motion
- Shards are groups of grains on one grid that share their motion and meet edge to edge, so each is a solid piece; the cracks open as neighbouring shards part.
- Pictures are drawn from their pixels in a canvas over the page while the element is hidden in place; serve pictures from other origins with CORS and crossOrigin="anonymous" for their real colours.
- Move focus somewhere sensible after a discard; the element leaves the accessibility tree once hidden.
- Under reduced motion the element fades out and in instead.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
Source
Registry item: /r/shatter-away.json


