流式结构化输出

New

流式结构化输出组件族:对不完整 JSON 容错的分色渲染——可承受未闭合字符串的增量 tokenizer、仅对新到片段做淡入、流式光标,以及函数调用外壳。

Tool call

web_search(

安装

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

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

API 参考

StreamingJson

text
string

The (possibly incomplete) JSON text to render, colorized as it grows.

streaming?
boolean

Appends a breathing block cursor at the tail while true.

false
bare?
boolean

Drops the rounded background/padding shell for inline embedding, e.g. inside `StreamingFunctionCall`.

false
className?
string

StreamingFunctionCall

name
string

Function / tool name shown before the argument list, e.g. `"web_search"`.

text
string

The (possibly incomplete) JSON argument text, rendered via `StreamingJson`'s bare variant.

streaming?
boolean
false
className?
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.