代码块

New

面向 Agent 的语法高亮代码面:稳定流式更新、可选行号与高亮行、有界平滑跟随、文件名/语言元数据与复制反馈。

summarize.tstypescriptWriting
1import { generateText } from "ai";

安装

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

$ bunx --bun shadcn add @uilab/code-block

API 参考

code
string
language?
"text" | "bash" | "diff" | "json" | "tsx" | "typescript"
typescript
filename?
ReactNode
status?
"streaming" | "complete"
complete
showLineNumbers?
boolean
true
highlightLines?
number[]
[]
maxHeight?
number
280
wrap?
boolean
false
copyable?
boolean
true
onCopy?
(() => void | Promise<void>)
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.