Streaming Response

Wraps an assistant answer during and after streaming: content renders as it arrives, then copy, retry and thumbs up or down appear, along with a collapsible footer listing the sources behind the answer.

Preview

Streaming Response preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/streaming-response
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

children
ReactNode

Rendered response content. Pass plain text or the output of a Markdown renderer.

—
status?
"error" | "complete" | "streaming"
streaming
copyText?
string

Plain-text value copied by the built-in copy action.

—
onCopy?
(() => void | Promise<void>)

Overrides the built-in clipboard action.

—
onRetry?
(() => void)
—
sources?
CitationItem[]

Optional sources shown as a compact footer disclosure after streaming.

[]
sourcesOpen?
boolean
—
defaultSourcesOpen?
boolean
false
onSourcesOpenChange?
((open: boolean) => void)
—
sourceIdPrefix?
string
—
feedback?
StreamingResponseFeedback
—
defaultFeedback?
StreamingResponseFeedback
null
onFeedbackChange?
((feedback: StreamingResponseFeedback) => void)
—
announce?
boolean

Set false when a surrounding conversation log announces streamed text.

true
showActions?
boolean

Hides the built-in completion actions without changing response status.

true
className?
string
—
contentClassName?
string
—
actionsClassName?
string
—

Composition

Hold the answer's streaming state in the message surface and leave the surrounding row untouched.

Message
└── MessageContent
    └── MessageBubble
        └── StreamingResponse

Note: Message anchors the answer in an assistant row. Citations links finished claims to their sources. Code Block shows code blocks inside the answer.

How it works

Every answer lives through two stages: first the text is still coming in, then it is done and ready to act on. Nothing should jump at that handoff, and rich formatting keeps rendering as usual throughout.

Updated