# Corner Chat Popup block

> Corner AI chat popup with history, expand and page context

An in app assistant launched from a bottom right button: a non modal chat window over the page with starter questions, a streaming thread, chat history, attachable page context, and expand, minimize and end chat controls.

- Type: Pro block
- Category: [AI Chat](https://web.dev.reui.io/blocks/ai-agents/ai-chat.md)
- Page: https://web.dev.reui.io/blocks/ai-agents/ai-chat/ai-chat-13
- MCP: `get_block("ai-chat-13")`
- Built with: Alert, Alert Dialog, Attachment, Avatar, Badge, Bubble, Button, Card, Code Block, Dropdown Menu, Empty, Field, Input Group, Item, Kbd, Marker, Popover, Separator, Skeleton, Spinner, Table, Tabs, Toggle Group, Tooltip
- Installs with a ReUI Pro or Ultimate license; setup: https://web.dev.reui.io/docs/license-setup

## Best for

A corner launcher whose non modal window expands, minimizes to a bar that flags a New Reply, and keeps a pinnable, deletable history

## Agent notes

- `composeReply` picks a canned `REPLY_LIBRARY` answer by keyword and only checks that some `sources` are attached; map your model's output into `AnswerBody`
- `PageBody` is a skeleton page to swap for yours, and its `UserMenu` items New Organization, Profile, Billing, Preferences and Sign Out have no handler
- Replace `THREADS`, `SOURCES` and `STARTERS`; pin, delete with its Undo `toast` and the `rate` thumbs change only local `threads` state and are never saved

## When not to use

- A full page new conversation screen with a greeting, start rows and an effort picker: use [Prompt Starter Welcome](https://web.dev.reui.io/blocks/ai-agents/ai-chat/ai-chat-3.md) (`get_block("ai-chat-3")`)
- An assistant docked open beside a document, whose reply is inserted into the draft: use [Docked Assistant](https://web.dev.reui.io/blocks/ai-agents/ai-chat/ai-chat-2.md) (`get_block("ai-chat-2")`)

## Third-party libraries

- Motion v12: [API reference](https://motion.dev/docs/react-motion-component), [docs](https://motion.dev/docs/react) (the docs follow the latest Motion, with no React API break since v12)
- Sonner v2: [API reference](https://sonner.emilkowal.ski/toast), [docs](https://sonner.emilkowal.ski/getting-started)
- next-themes: [API reference](https://github.com/pacocoursey/next-themes#api), [docs](https://github.com/pacocoursey/next-themes)
- Shiki v4: [API reference](https://shiki.style/guide/install), [docs](https://shiki.style/guide/), through ReUI Code Block

## Install

```bash
npx shadcn@latest add @reui/ai-chat-13
```

## About AI Chat blocks

### When to use

- A full page assistant chat, new chat welcome screen or 2 model comparison inside an AI product
- A copilot docked beside the page it works on, or opened from a launcher in the page corner
- Answers that show the work behind them: sources read, tool steps, plans to approve and run cost

### When not to use

- The product layout around the chat: a sidebar of threads, workspaces and account menus: use the [App Shell blocks](https://web.dev.reui.io/blocks/application/app-shell.md)
- A plain overlay chat panel opened from a button, with suggestion chips and a composer: use the [Sheet blocks](https://web.dev.reui.io/blocks/application/sheet.md)
- A highlighted snippet with a filename header and copy button, outside any conversation: use [Code Block](https://web.dev.reui.io/components/code-block.md) (`get_component("code-block")`)

### Agent notes

- Each `AiChat` root sizes itself to the viewport with `h-svh`, or `min-h-svh` in ai-chat-5; give it your layout's height inside an app shell
- Every reply is canned content from the block's data file, played back on `setTimeout` and `setInterval` timers; stream your model's output there instead

Every ReUI item has a twin like this one; the index is https://web.dev.reui.io/llms.txt. Agents with the ReUI MCP (https://web.dev.reui.io/docs/mcp) get the same guidance from the getters named above.
