---
title: "Flag Dissolve"
description: "Treat a picture as cloth on a pole. Waves run along it, then the wind tears it away from the free edge."
url: https://gelatinui.com/components/flag-dissolve
markdown_url: https://gelatinui.com/components/flag-dissolve.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/flag-dissolve"
version: "2026-11-18"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Flag Dissolve

> Treat a picture as cloth on a pole. Waves run along it, then the wind tears it away from the free edge.

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

## When to use it

Best for: Wide banners and campaign art that should wave once, then leave on the wind.

- Use it for banners, event art, and seasonal promotions.
- Raise `amplitude` for taller waves on a large banner.
- Lower `wind` to keep the torn pieces close in a narrow layout.

## When not to use it

- For light dust with no cloth wave, use [Dust Dissolve](https://gelatinui.com/components/dust-dissolve.md).
- To open a picture from the middle, use [Curtain Dissolve](https://gelatinui.com/components/curtain-dissolve.md).

## Notes for agents

- The pole is at the reading start, and the far edge tears first.
- Pass `origin="end"` to put the pole on the other side.
- The pieces travel far to the side. Use it where the page has free width.
- The wave height follows the box height and `amplitude`.

## Anatomy

```text
FlagDissolve
```

## API reference

### FlagDissolve

| 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. |
| `origin` | `GrainOrigin` |  | Where the effect starts. `press` is the last press in the picture. |
| `spread` | `number` |  | From 0 to 0.85: how much of the effect passes between the first grain that leaves and the last. |
| `jitter` | `number` |  | From 0 to 0.85: how much of each grain's start is random. |
| `duration` | `number` |  | How long the cloth takes to tear away, in ms. Default `1800`. |
| `wind` | `number` |  | How far the wind carries the torn grains. Default `1`. |
| `amplitude` | `number` |  | From 0 to 2: how tall the waves in the cloth are. Default `1`. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| FlagDissolve | `flag-dissolve` |  |  |  |

## Usage

Take the banner down when the event ends.

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-pro/flag-dissolve @gelatin-ui/button
```

```tsx title="festival-banner.tsx"
"use client";

import { useState } from "react";

import { FlagDissolve } from "@/components/pro/effects/flag-dissolve";
import { Button } from "@/components/ui/button";

export function FestivalBanner() {
  const [down, setDown] = useState(false);
  return (
    <section className="flex w-full max-w-lg flex-col gap-3">
      <FlagDissolve
        src="/photos/old-town.webp"
        alt="A narrow street in an old town"
        dissolved={down}
        amplitude={1.4}
        className="aspect-video w-full"
      />
      <div className="flex items-center justify-between gap-4 text-sm">
        Old town festival, Saturday
        <Button
          size="sm"
          variant="outline"
          onClick={() => {
            setDown((value) => {
              return !value;
            });
          }}
        >
          {down ? "Raise again" : "Take down"}
        </Button>
      </div>
    </section>
  );
}
```

## 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-pro/flag-dissolve
```

It adds 35 registry items: 34 files, 6526 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

- [Curtain Dissolve](https://gelatinui.com/components/curtain-dissolve.md)
- [Dust Dissolve](https://gelatinui.com/components/dust-dissolve.md)
- [Parallax Image](https://gelatinui.com/components/parallax-image.md)
- [Mask Reveal](https://gelatinui.com/components/mask-reveal.md)

## Motion

| Part | Motion |
| --- | --- |
| Wave and tear | reactionFloat · 1.8s · waves run along the cloth, then the free edge blows away |
| Back | reactionFloat · 1.8s · the cloth flies back and settles flat |
