File Diff

Preview

File changes

Install

Add it with the shadcn CLI, or copy the source manually.

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

API Reference

file
ReactNode
Default—
lines
FileDiffLine[]
Default—
status?
"complete" | "streaming"
Defaultstreaming
open?
boolean
Default—
defaultOpen?
boolean
Defaulttrue
onOpenChange?
((open: boolean) => void)
Default—
collapseOnComplete?
boolean
Defaulttrue
maxHeight?
number
Default220
language?
"text" | "bash" | "diff" | "json" | "tsx" | "typescript"
Defaulttypescript
copyText?
string
Default—
onCopy?
(() => void | Promise<void>)
Default—
className?
string
Default—

Composition

Place the patch inside the tool output that produced the file change.

ToolResult
└── ToolResultOutput
    └── FileDiff

Note: Code Block provides the shared syntax presentation for source lines. Tool Result summarizes the command or edit that produced the patch. Agent Activity records the file edit among surrounding agent events.

How it works

A file diff explains a proposed or completed edit. It should preserve the relationship between old and new lines while making the scale and status of the change visible at a glance.

Also on React Native. Changes with live counts and folded context.

Updated