File DiffProv1.0.0
A change to one file, read the way a reviewer reads it: old and new line numbers, a soft green or red wash on changed lines that screen readers hear as Added and Removed, long unchanged stretches folded away, and a header that counts the change and copies the patch.
pnpm dlx shadcn@latest add @beautiful-ui-pro/lumen-file-diffNeeds your registry key. Your components.json style picks the Base UI or Radix build: radix-*, new-york and default get Radix, base-* gets Base UI.
Styles didn't apply?
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Usage
Import it and pass your content. The props that matter most are listed next.
"use client";
import { FileDiff } from "@/components/ui/lumen/controls/file-diff";
const patch = `--- a/config/alerts.yaml
+++ b/config/alerts.yaml
@@ -3,4 +3,5 @@ alerts:
- metric: trial_conversion
window: 7d
- drop: 25%
+ drop: 15%
+ notify: "#growth"
owner: growth
`;
export function ProposedChange() {
return <FileDiff patch={patch} collapsible />;
}Props
patch–stringA unified diff (git diff, diff -u). Hunks, numbers and the file name are read from it.
lines / oldStart / newStart–DiffLine[] / numberOr the lines: { type: "+" | "-" | " ", text }, Agent Run's shape, numbered from the starts (default 1).
file–stringThe path; read from the patch when omitted.
context3numberUnchanged lines kept around each change; longer stretches fold.
copy"patch""patch" | "after" | falseWhat Copy copies: the patch, the new text, or no button.
collapsible / defaultOpenfalse / truebooleanThe header opens and closes the changes.
Show all 7 propsShow fewer
labels–Partial<FileDiffLabels>Every word, for other languages.
Source
components/ui/lumen/controls/file-diff.tsx
This component is included with Pro.
Try the live preview above. Get Pro to install the source.