Streaming Response

A streaming AI response surface with sources and feedback actions — copy, retry, thumbs, and a citations disclosure via agent-disclosure.

Streaming

Tokens stream in while status="streaming", then actions and sources appear. Replay remounts.

Loading…

Installation

CLI
npx @sonojs/ui@latest add streaming-response
Also needsnpx @sonojs/ui@latest add agent-disclosure citations && npm i lucide-react motion

Usage

streaming-response.tsx
import { StreamingResponse } from "@/components/sonojs/streaming-response"

export function Example() {
  return (
    <StreamingResponse
      status="complete"
      copyText="Hello from Sono"
      sources={[
        {
          id: "docs",
          title: "SonoJS Docs",
          domain: "sonojs.com",
          url: "https://sonojs.com",
        },
      ]}
    >
      <p>Hello from Sono</p>
    </StreamingResponse>
  )
}

Props

PropTypeDefaultDescription
childrenReactNode—Response body (text or rendered markdown).
status"streaming" · "complete" · "error""streaming"Controls busy state and when actions appear.
copyText / onCopystring / () => void—Enables the copy action.
onRetry() => void—Shows a retry control when provided.
sourcesCitationItem[][]Optional footer sources stack + list.
feedback / onFeedbackChange"up" · "down" · nullnullThumbs up/down after complete.
showActionsbooleantrueHide the action row without changing status.
announcebooleantruearia-live polite on the content region.
classNamestring—Optional class names on the root.