流式回复

New

稳定的流式回答面:完成后复制/重试/反馈、可选可展开来源摘要,以及嵌套 live region 播报控制。

安装

用 shadcn CLI 添加,或手动复制源码。

$ bunx --bun shadcn add @uilab/streaming-response

API 参考

children
ReactNode

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

status?
"error" | "streaming" | "complete"
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

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.