# File Change

Interactive file-change review list with diff expansion, per-file accept/reject actions, and accept-all shortcut



<ComponentPreview base="ink" name="file-change-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/file-change
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="ink" name="file-change" title="components/ui/file-change.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { FileChange } from "@/components/ui/file-change";
```

```tsx
<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 [#api-reference]

FileChange [#filechange]

| Prop          | Type                     | Default    |
| ------------- | ------------------------ | ---------- |
| `changes`     | `FileChangeItem[]`       | `required` |
| `onAccept`    | `(path: string) => void` | -          |
| `onReject`    | `(path: string) => void` | -          |
| `onAcceptAll` | `() => void`             | -          |
