---
title: "Sand Dissolve"
description: "A picture that falls apart into real sand when it is deleted: the grains pile up, slide, then pour away. Restore lifts them back."
url: https://gelatinui.com/components/sand-dissolve
markdown_url: https://gelatinui.com/components/sand-dissolve.md
access: free
install: "npx shadcn@latest add @gelatin-ui/sand-dissolve"
registry_item: https://gelatinui.com/r/sand-dissolve.json
version: "2026-11-18"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Sand Dissolve

> A picture that falls apart into real sand when it is deleted: the grains pile up, slide, then pour away. Restore lifts them back.

Page: https://gelatinui.com/components/sand-dissolve

## When to use it

Best for: Deleting one photo or card when the removal should feel heavy and final.

- Set `dissolved` when the person confirms the delete.
- Remove the row from your list in `onDissolveEnd`, after the pile has poured away.
- Raise `gravity` for a fast, tight pile, or lower `grainSize` for fine sand.

## When not to use it

- For a light dismiss with no weight, use [Dust Dissolve](https://gelatinui.com/components/dust-dissolve.md).
- For a card that turns into a paper ball and flies to a bin, use [Crumple to Delete](https://gelatinui.com/components/crumple-to-delete.md).
- For grains that hop on the floor and fade, use [Bounce Dissolve](https://gelatinui.com/components/bounce-dissolve.md).

## Notes for agents

- The fall is a small physics world: a sweep starts on the end side of the reading direction, grains land, slide to rest, then the floor opens.
- `duration` sets only the way back. The fall takes as long as the pile needs, and `spread`, `jitter`, and `gravity` shape it.
- `dissolved={false}` during the fall lifts each grain from where it is now.
- With `progress` the grains follow the way back, not the physics: no pile forms during a scrub.
- The sand stays inside the box at the sides and floor, so the page around it needs no spare room.

## Anatomy

```text
SandDissolve
```

## API reference

### SandDissolve

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `src` | `string` |  | The picture URL. Give `src` or `source`. |
| `source` | `union` |  | A picture the page already has: an `<img>`, a `<canvas>`, an `ImageBitmap`, or an `OffscreenCanvas`. |
| `alt` | `string` |  | Names the picture for screen readers while it shows. |
| `crossOrigin` | `GrainCrossOrigin` |  | The CORS mode of a picture on another origin: the grains read its pixels. |
| `fit` | `GrainFit` |  | How the picture fills the box, as `object-fit`. Default `cover`. |
| `grainSize` | `number` |  | The side of one grain in CSS px. A very large box raises it, so the effect stays smooth. |
| `dissolved` | `boolean` |  | The picture is gone (controlled). `true` takes it apart; `false` brings it back. |
| `restore` | `"instant" \| "play"` |  | How the picture comes back: `play` runs the effect backward, `instant` shows it at once. Default `play`. |
| `progress` | `number` |  | From 0 (whole) to 1 (gone): a gesture drives the effect and no clock runs. Leave it out to play. |
| `seed` | `number` |  | The same seed gives the same motion. Default: from the picture URL. |
| `onDissolveEnd` | `function` |  | Called when the last grain has left (or the fade has ended). |
| `onRestoreEnd` | `function` |  | Called when the picture is whole again after a played return. |
| `duration` | `number` |  | How long the pile takes to rise back into the picture, in ms. The fall keeps its own pace. Default `1800`. |
| `spread` | `number` |  | From 0 to 0.85: how long the sweep takes to cross the picture. Default `0.35`. |
| `jitter` | `number` |  | From 0 to 0.85: how ragged the edge of the sweep is. Default `0.2`. |
| `gravity` | `number` |  | How fast the sand falls and packs. Default `1`. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| SandDissolve | `sand-dissolve` |  |  |  |

## Usage

Delete the photo, then drop its row when the sand has poured away.

The sample also uses `button`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/sand-dissolve @gelatin-ui/button
```

```tsx title="deletable-photo.tsx"
"use client";

import { useState } from "react";

import { SandDissolve } from "@/components/effects/sand-dissolve";
import { Button } from "@/components/ui/button";

export function DeletablePhoto({ onDeleted }: { onDeleted: () => void }) {
  const [deleting, setDeleting] = useState(false);
  return (
    <figure className="flex w-80 max-w-full flex-col gap-3">
      <SandDissolve
        src="/photos/lake-cabin.webp"
        alt="A lake cabin on a summer day"
        dissolved={deleting}
        onDissolveEnd={onDeleted}
      />
      <figcaption className="flex items-center justify-between text-sm">
        Lake cabin, July
        <Button variant="secondary" size="sm" onClick={() => setDeleting(true)}>
          Delete photo
        </Button>
      </figcaption>
    </figure>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/sand-dissolve
```

It adds 35 registry items: 34 files, 6520 lines, and the npm packages `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Crumple to Delete](https://gelatinui.com/components/crumple-to-delete.md)
- [Dust Dissolve](https://gelatinui.com/components/dust-dissolve.md)
- [Bounce Dissolve](https://gelatinui.com/components/bounce-dissolve.md)
- [Scratch Card](https://gelatinui.com/components/scratch-card.md)
- [Receipt Printer](https://gelatinui.com/components/receipt-printer.md)

## Motion

| Part | Motion |
| --- | --- |
| Back | reactionFloat · 1.8s · each grain rises from the pile in a low arc to its place |
| End | none · the whole picture replaces the grains in one frame |
