# Unsend Message

A chat thread where you can take a message back: the letters lift off your bubble one after another and fly down into the message box on a thin thread, landing exactly where you'd have typed them, while the empty bubble shrinks away.

- Page and source: https://uibrik.com/components/unsend-message
- Install (Pro, needs a license key, see https://uibrik.com/docs/pro): `npx shadcn@latest add @uibrik-pro/unsend-message`
- Packages: none beyond React
- Import: `import { UnsendMessage } from "@/components/uibrik/unsend-message/unsend-message"`

Where to use the Unsend Message React component:

- **Messaging apps**: Unsend puts the text back in the box instead of deleting it, so fixing a typo takes one tap and a quick edit. Pairs with [Chat Card](https://uibrik.com/components/chat-card) and [Reaction Bar](https://uibrik.com/components/reaction-bar).
- **Support and AI chat**: Taking back a prompt before the reply arrives lets people reword it without retyping. Pairs with [Streaming Chat](https://uibrik.com/components/streaming-chat) and [Prompt Input](https://uibrik.com/components/prompt-input).
- **Team chat and comments**: A time window limits unsending to fresh messages, matching how most chat products work.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| accent | `string` | `"#3b82f6"` | Your bubbles, the send button and the thread. |
| duration | `number` | `620` | How long each letter takes to fly. |
| stagger | `number` | `22` | Delay between neighbouring letters leaving. |
| thread | `boolean` | `true` | Draw the thread that joins the flying letters. |
| unsendWindow | `number` | `120` | Seconds a message can be unsent for. 0 means always. |
| placeholder | `string` | `"Message"` | Placeholder in the message box. |
| messages | `{ id: string; from: "me" \| "them"; text: string; at?: number }[]` |  | The thread. Pass with onMessagesChange to control it. |
| defaultMessages | `UnsendChatMessage[]` |  | Starting thread when uncontrolled. |
| onMessagesChange | `(messages: UnsendChatMessage[]) => void` |  | Called when a message is sent or unsent. |
| onSend | `(message: UnsendChatMessage) => void` |  | Called after you send a message. |
| onUnsend | `(message: UnsendChatMessage) => void` |  | Called once the letters have landed in the box. |
| ref | `Ref<{ unsend(id: string): void; send(text: string): void }>` |  | Drive it from code. |
| aria-label | `string` | `"Conversation"` | Accessible name for the thread. |
| className | `string` |  | Classes for the wrapper. Give it a height; the thread scrolls inside. |
