Chat
ContextCards
Render retrieved conversation chunks supplied by the host. Stable IDs identify sources and selection; source-open and inclusion callbacks never perform retrieval or read files.
Render retrieved conversation chunks supplied by the host. Stable IDs identify sources and selection; source-open and inclusion callbacks never perform retrieval or read files.
Import
tsx1 line
import { ContextCards } 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.
ContextCards
Retrieved context
1 sourceConversation integration
The host supplies messages, retrieval context and execution state. YunUI provides the reusable interaction surfaces.
Context is supplied by the host.
Composition
tsx3 linesScroll horizontally
import { ContextCards } from "@yuhuanowo/yunui/chat";
<ContextCards chunks={[{ id: "guide", title: "Guide", body: "The host owns retrieval.", source: "Guide.md", badge: "MD", href: "/guide" }]} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| chunks* | readonly ContextChunk[] | — | |
| labels | ContextCardsLabels | — | |
| onSelectionChange | ((id: string, selected: boolean) => void) | — | The host supplies the next selected value. Without this callback no Include/Exclude control is shown. |
| onSourceOpen | ((chunk: ContextChunk) => void) | — |