# Dust delete

Delete a file and it turns to dust that blows into the trash.

Also called: delete animation, disintegrate, particle delete, trash animation.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Delete to dust. Delete a file and it turns to dust grain by grain, rides the wind into the trash and the lid gulps it down; Undo pours it back out and the row rebuilds. Preview: https://chatcn.dev/preview/dust-delete-demo

The row is drawn grain by grain from its own pixels, so the dust is its real colours in either theme. A sweep crosses it from the right and each grain lifts off as the sweep passes, rides a curling wind and is pulled into the trash, whose lid lifts while dust is in the air and gulps as it lands. The count on the bin ticks up and the totals roll down. Undo pours the dust back out of the bin along arcs and the row rebuilds itself from the left.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/dust-delete
```

## Usage

```tsx
import { DustDelete } from "@/components/ui/chatcn/pro/dust-delete"

<DustDelete title="Knowledge" items={files} onDelete={(id) => remove(id)} />
```

`onDelete` runs once Undo has run out, so remove the item there. Until then the row stays hidden inside the list and Undo brings it back.

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `items` | `{ id, name, detail?, icon?, tint?, size? }[]` | `size` in bytes, for the total |
| `onDelete` | `(id: string) => void` | After Undo runs out |
| `title` | `ReactNode` |  |
| `onOpenTrash` | `() => void` | The trash button |
| `trashCount` | `number` | Already in the trash, for the bin's count |
| `undoMs` | `number` | Default 6000, counted once the dust has settled |

## Accessibility

- Each row's button is labelled Delete and the file's name; the Moved to Trash note is a status, and focus moves to the next row when the delete came from the keyboard.

## Motion

- The sweep takes 620 ms and the dust lands in about 1.4 s; the row closes on a spring. Reduced motion: no dust, the row just closes.

Source: https://chatcn.dev/docs/components/dust-delete