API and Development
Response, ResponseSize from @prepared911/ui/response.
| Prop | Type | Default | Notes |
|---|---|---|---|
children | string | required | The Markdown source |
labels | ResponseLabels | required | Copy for links, code, tables and footnotes |
streaming | boolean | false | Treat the source as a growing stream and complete unfinished Markdown |
size | ResponseSize | Default | Compact sets paragraphs and lists, and so their links, at Body Medium; use it inside a Reasoning |
components | Components (react-markdown) | Element overrides merged over the defaults; keep the object stable | |
className | string | Appended after the generated classes | |
ref | Ref<HTMLDivElement> | The root element |
| Field | Type | Used for |
|---|---|---|
newTab | LocalizedMessage | Announced after a link that opens in a new tab |
code | LocalizedMessage | Name of each code block and its scroll area |
copyCode | LocalizedMessage | Name of a code block's copy control at rest |
copiedCode | LocalizedMessage | The copy control once copied |
copyCodeError | LocalizedMessage | The copy control when the clipboard refused |
table | LocalizedMessage | Name of each table's scroll area |
footnotes | LocalizedMessage | Name of the footnotes section |
footnoteBack | LocalizedMessage | Name of the link from a footnote back to its reference |
Response and the types ResponseProps and ResponseLabels. Response shares its name with the global Fetch Response; import it from the package so the module scope shadows the global.
react-markdown ^9, remark-gfm ^4 and remend ^1.3, ordinary dependencies kept external by the build. See packages/ui/docs/decisions/0008-package-build.md.
| Name | Type | Default | Description |
|---|---|---|---|
children | string | — | The markdown source of the response. Data, not copy, so it is a plain string. |
labels | ResponseLabels | — | Copy for links, code blocks, tables and footnotes. Memoized blocks only redraw when a label's text changes. |
className | string | — | Classes appended after the generated classes. Put overrides in @layer chroma.overrides. |
components | Components | — | Element overrides merged over the default mapping. Pass a stable object (module-level or memoized): a new object redraws every block. |
ref | Ref<HTMLDivElement> | — | Ref to the root element. |
size | ResponseSize | ResponseSize.Default | Size of the running text. Compact sets paragraphs and lists, and so the links in them, at Body Medium, which is
the size of a Reasoning trigger. |
streaming | boolean | false | Treats the source as a token stream that is still growing. Unfinished markdown (an unclosed **, a half-open code
fence, a dangling link) is completed before it is parsed, so partial output draws without breaking the layout. |