StreamingText
Provide exact text tokens, stable source IDs and stream state from the host. One public component renders citations, source disclosure, message actions and follow-ups; it never calls a model or simulates streaming.
Provide exact text tokens, stable source IDs and stream state from the host. One public component renders citations, source disclosure, message actions and follow-ups; it never calls a model or simulates streaming.
Import
import { StreamingText } from "@yuhuanowo/yunui/chat";Interactive example
The controls below explicitly simulate host responses; no request is sent. All labels and accessibility copy can be overridden. Missing callbacks disable the corresponding request controls.
StreamingText
The conversation components now use the public YunUI API. YunUI docs Review the proposed changes before applying them.
Follow-ups
No request sent.
Composition
import { StreamingText } from "@yuhuanowo/yunui/chat";
<StreamingText content={[{ text: "Read the guide. " }, { text: "", sourceId: "guide" }]} sources={[{ id: "guide", name: "Guide", href: "/guide" }]} state="complete" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | |
| content* | readonly StreamingToken[] | — | Exact host-provided token sequence. YunUI does not insert or normalize whitespace. |
| defaultSourcesOpen | boolean | false | |
| followUps | readonly string[] | [] | |
| labels | StreamingTextLabels | — | |
| onAction | ((action: StreamingAction) => void) | — | |
| onFollowUp | ((text: string, index: number) => void) | — | |
| onSourcesOpenChange | ((open: boolean) => void) | — | |
| sources | readonly StreamingSource[] | [] | |
| sourcesOpen | boolean | — | Controlled source disclosure. Without `onSourcesOpenChange`, it is read-only. |
| state | "streaming" | "complete" | "error" | "cancelled" | "empty" | complete | |
| visibleCount | number | — | Optional host-controlled prefix length while streaming. |