Utility
AI
Terminal
Installation
pnpm dlx shadcn@latest add https://termcn.dev/r/file-change.json
Usage
import { FileChange } from "@/components/ui/file-change";<FileChange
changes={[
{ path: "src/utils.ts", type: "modify", diff: "-old line\n+new line" },
{
path: "src/helpers.ts",
type: "create",
content: "export const add = (a, b) => a + b;",
},
{ path: "src/legacy.ts", type: "delete" },
]}
onAccept={(path) => console.log("accepted", path)}
onReject={(path) => console.log("rejected", path)}
onAcceptAll={() => console.log("accepted all")}
/>API Reference
FileChange
| Prop | Type | Default |
|---|---|---|
changes | FileChangeItem[] | required |
onAccept | (path: string) => void | undefined |
onReject | (path: string) => void | undefined |
onAcceptAll | () => void | undefined |