# StreamingResponse

Shows an answer as it streams in, and says clearly if it was cut off or failed.

- **Use it for**: Rendering a reply as it streams, with interrupted and failed states.
- **Not for**: Formatted Markdown replies. Try [MarkdownResponse](https://unseenui.com/components/markdown-response/).

## Installation

```bash
npm install @stackunseen/ui react-markdown remark-gfm remend
```

## Usage

```tsx
import '@stackunseen/ui/styles.css';

import { MarkdownResponse } from '@stackunseen/ui/markdown';

<MarkdownResponse variant="cursor" text={text} state={state} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `error` | `string` |  |
| `followUps` | `readonly FollowUp[]` | Short next steps offered once the response is complete. |
| `onFollowUp` | `((item: FollowUp) => void)` |  |
| `onStop` | `(() => void)` | With progress: a Stop action beside the line. |
| `progress` | `ResponseProgress` | Where a multi-step answer stands, as your server reports it: "Writing 2 of 3 · 142 → 46". |
| `renderContent` | `((content: { text: string; state: MessageData["state"]; }) => ReactNode)` | Trusted application renderer. |
| `showStatus` | `boolean` | Composite messages announce status once at the message boundary. |
| `state` (required) | `MessageState` |  |
| `text` (required) | `string` |  |
| `variant` | `"cursor" \| "dots" \| "shimmer"` |  |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[Chat](https://unseenui.com/components/chat/), [PromptInput](https://unseenui.com/components/prompt-input/), [Message](https://unseenui.com/components/message/), [MessageActions](https://unseenui.com/components/message-actions/), [Suggestions](https://unseenui.com/components/suggestions/), [Attachment](https://unseenui.com/components/attachment/), [AttachmentTray](https://unseenui.com/components/attachment-tray/), [FileDropzone](https://unseenui.com/components/file-dropzone/), [ModelSelector](https://unseenui.com/components/model-selector/), [FeedbackCapture](https://unseenui.com/components/feedback-capture/), [Reasoning](https://unseenui.com/components/reasoning/), [SuggestTextarea](https://unseenui.com/components/suggest-textarea/)

Page: https://unseenui.com/components/streaming-response/
