文件差异

New

语法高亮的文件变更披露:渐进行、行号、实时增删计数、有界平滑跟随,完成后可折叠。

File changes

安装

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

$ bunx --bun shadcn add @uilab/file-diff

API 参考

file
ReactNode
lines
FileDiffLine[]
status?
"streaming" | "complete"
streaming
open?
boolean
defaultOpen?
boolean
true
onOpenChange?
((open: boolean) => void)
collapseOnComplete?
boolean
true
maxHeight?
number
220
language?
"text" | "bash" | "diff" | "json" | "tsx" | "typescript"
typescript
copyText?
string
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.