# Message delete

Deleting a message without a hole: it blurs away into a slim note with a draining Undo.

Also called: delete message animation, undo delete.

Example: Delete without a hole. The message washes red and blurs away as its row closes to a slim note; a line under Undo drains while you can take it back, then the note folds shut. Preview: https://chatcn.dev/preview/message-delete-demo

The message washes red and blurs away as its row closes down to a slim Message deleted note, the messages below rising to meet it. A thin line under Undo drains for as long as you can take it back. Undo opens the row again and the message comes back into focus; when the line runs out, the note folds shut and the gap closes.

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/message-delete.json
```

## Usage

```tsx
import { MessageDelete } from "@/components/ui/chatcn/message-delete"

<MessageDelete deleted={deleted} onUndo={() => setDeleted(false)} onGone={() => remove(message.id)}>
  <Bubble>{message.text}</Bubble>
</MessageDelete>
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `deleted` | `boolean` | Turning it on plays the delete |
| `onUndo` | `() => void` | Shows Undo |
| `onGone` | `() => void` | After the note has folded: remove it for good here |
| `undoMs` | `number` | Default 4000 |

## Accessibility

- The note is a status; the deleted message leaves the accessibility tree.

## Motion

- Height closes 560 ms while the message blurs out 420 ms. Reduced motion: it swaps to the note.

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