# Shadcn Streaming Reply

> Streaming reply that follows the edge

- Type: example, free and open source (MIT)
- Component: [Message Scroller](https://web.dev.reui.io/components/message-scroller.md)
- Page: https://web.dev.reui.io/components/message-scroller/c-message-scroller-2
- Docs (Base UI): https://ui.shadcn.com/docs/components/base/message-scroller.md
- Docs (Radix UI): https://ui.shadcn.com/docs/components/radix/message-scroller.md
- MCP: `get_example("c-message-scroller-2")`
- Registry item: https://web.dev.reui.io/r/styles/base-nova/c-message-scroller-2.json
- Uses: Avatar, Badge, Bubble, Button, Card, Message, Message Scroller, Spinner

## Best for

A reply typed out 4 characters every 28ms under a Working badge, with aria-busy on the log and a Replay stream button

## Agent notes

- Swap the `setTimeout` loop that slices `REPLY` for your stream, appending chunks to the row whose id is `REPLY_ID`
- Keep `aria-busy` on `MessageScrollerContent` while a reply streams, so the log announces the finished row once instead of per chunk

## When not to use

- A settled thread where no reply is being written: use [Jump to Latest](https://web.dev.reui.io/components/message-scroller/c-message-scroller-1.md) (`get_example("c-message-scroller-1")`)

## Install

```bash
npx shadcn@latest add @reui/c-message-scroller-2
```

## About Shadcn Message Scroller

### When to use

- Chat and assistant transcripts in a bounded panel that open on the newest turn and offer a jump back to it
- Streaming replies that follow the bottom until the reader scrolls up, with sent questions lifted near the top
- Saved threads that reopen at a chosen turn, load older history above the reader or step between questions

### When not to use

- The layout of a single turn, its avatar, sender name and timestamp around the body: use [Message](https://web.dev.reui.io/components/message.md) (`get_component("message")`)
- A sidebar, settings list or panel that overflows but never grows at the bottom: use [Scroll Area](https://web.dev.reui.io/components/scroll-area.md) (`get_component("scroll-area")`)
- A finished assistant screen with composer, thread list, citations and docked panels: use the [AI Chat blocks](https://web.dev.reui.io/blocks/ai-agents/ai-chat.md)

### Agent notes

- The parts and hooks throw outside `MessageScrollerProvider`, so a header or footer control that calls a hook needs the provider above it too
- `MessageScroller` fills its parent through `size-full`, so bound the parent height or the page scrolls instead of the transcript
- Render `MessageScrollerButton` as a sibling of `MessageScrollerViewport`; placed inside it, the control scrolls away with the rows

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.
