import { Button, FilesChanged } from "@replicas/ui";

export default function FilesChangedDemo() {
  return (
    <FilesChanged.Root style={{ width: "100%", maxWidth: 520 }}>
      <FilesChanged.Header>
        <FilesChanged.Title>4 files changed</FilesChanged.Title>
        <FilesChanged.Additions>128</FilesChanged.Additions>
        <FilesChanged.Deletions>36</FilesChanged.Deletions>
        <FilesChanged.Actions>
          <Button variant="ghost" size="small">
            Undo
          </Button>
          <Button size="small">Review</Button>
        </FilesChanged.Actions>
      </FilesChanged.Header>
      <FilesChanged.List>
        <FilesChanged.File path="apps/web/app/settings/page.tsx" additions={64} deletions={12} />
        <FilesChanged.File path="apps/web/lib/billing.ts" additions={41} deletions={18} />
        <FilesChanged.File path="packages/db/migrations/0042_plans.sql" change="added" additions={23} />
        <FilesChanged.File path="apps/web/lib/legacy-billing.ts" change="deleted" deletions={6} />
      </FilesChanged.List>
    </FilesChanged.Root>
  );
}

Prompt

Copy Prompt hands your agent everything it needs to build the Files Changed in the Interfere style: the measured tokens, the CSS and the structure.

Show Prompt
# Interfere Files Changed

The files an agent edited, with line counts and buttons to review or undo.

Build a Files Changed in this project that looks and behaves like Interfere's. Measured from the running Interfere app (interfere.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Concept, not a real feature. Designed from the Code Card and Menu on Interfere's design site. Interfere has no diff list. Paths use Code Card monospace, and rows use the Menu item hover.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--tomato-a11` | `#cd2200ea` | `#ff977d` |
| `--green-a11` | `#00713fde` | `#46fea5d4` |
| `--color-component-on-container-subtle` | `#fff` | `#ffffff09` |
| `--color-transparent-hover` | `#0000000f` | `#ffffff1b` |
| `--color-primary-foreground` | `#000000df` | `#ffffffed` |
| `--color-secondary-foreground` | `#0000009b` | `#ffffffaf` |
| `--color-tertiary-foreground` | `#00000072` | `#ffffff64` |
| `--color-brand-foreground` | `#0086f0fa` | `#3b9eff` |
| `--color-border-default` | `#0000000f` | `#ffffff12` |
| `--s-default` | `0 0 0 .5px var(--shadow-inner-1) inset, 0 0 0 .5px var(--shadow-drop-1), 0 1px 1px -1px var(--shadow-drop-2), 0 1px 2px 0px var(--shadow-drop-3)` | `0 0 0 .5px #ffffff12 inset, 0 0 0 .5px #0000, 0 1px 1px -1px #0000, 0 1px 2px 0px #0000` |
| `--font-regular` | `"InterVariable", "Inter Variable", "InterVariable Fallback", sans-serif` | `"InterVariable", "Inter Variable", "InterVariable Fallback", sans-serif` |
| `--font-monospace` | `"BerkeleyMono", "Berkeley Mono", "BerkeleyMono Fallback", monospace` | `"BerkeleyMono", "Berkeley Mono", "BerkeleyMono Fallback", monospace` |
| `--font-features` | `"ss03"` | `"ss03"` |
| `--font-size-small` | `13px` | `13px` |
| `--font-weight-medium` | `500` | `500` |
| `--radius-md` | `6px` | `6px` |
| `--radius-xl` | `10px` | `10px` |
| `--ease-out` | `cubic-bezier(0, 0, 0.2, 1)` | `cubic-bezier(0, 0, 0.2, 1)` |
| `--default-transition-duration` | `150ms` | `150ms` |
| `--code-size-xs` | `12px` | `12px` |

## CSS

Scoped under `[data-style="interfere"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="interfere"] {
  .ui-files-changed {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background-color: var(--color-component-on-container-subtle);
    box-shadow: var(--s-default);
    color: var(--color-primary-foreground);
    font-family: var(--font-regular);
    font-feature-settings: var(--font-features);
    font-size: var(--font-size-small);
    line-height: 20px;
  }

  .ui-files-changed-header {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 6px 6px 12px;
    border-bottom: 0.5px solid var(--color-border-default);
  }

  .ui-files-changed-title {
    min-width: 0;
    overflow: hidden;
    color: var(--color-primary-foreground);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ui-files-changed-additions,
  .ui-files-changed-deletions {
    flex-shrink: 0;
    font-family: var(--font-monospace);
    font-size: var(--code-size-xs);
    line-height: 16px;
    font-variant-numeric: tabular-nums;
  }

  .ui-files-changed-additions {
    color: var(--green-a11);
  }

  .ui-files-changed-deletions {
    color: var(--tomato-a11);
  }

  .ui-files-changed-header > .ui-files-changed-deletions {
    margin-inline-start: -4px;
  }

  .ui-files-changed-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
  }

  .ui-files-changed-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 4px;
    list-style: none;
  }

  .ui-files-changed-file {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 4px 6px 4px 8px;
    border-radius: var(--radius-md);
    transition: background-color var(--default-transition-duration) var(--ease-out);

    @media (hover: hover) {
      &:hover {
        background-color: var(--color-transparent-hover);
      }
    }
  }

  .ui-files-changed-icon {
    display: flex;
    flex-shrink: 0;
    color: var(--color-tertiary-foreground);

    & > svg {
      width: 16px;
      height: 16px;
    }
  }

  .ui-files-changed-file[data-change="added"] .ui-files-changed-icon {
    color: var(--green-a11);
  }

  .ui-files-changed-file[data-change="deleted"] .ui-files-changed-icon {
    color: var(--tomato-a11);
  }

  .ui-files-changed-file[data-change="renamed"] .ui-files-changed-icon {
    color: var(--color-brand-foreground);
  }

  .ui-files-changed-path {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-family: var(--font-monospace);
    font-size: var(--code-size-xs);
    line-height: 16px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ui-files-changed-directory {
    color: var(--color-tertiary-foreground);
  }

  .ui-files-changed-name {
    color: var(--color-primary-foreground);
  }

  .ui-files-changed-file[data-change="deleted"] .ui-files-changed-name {
    color: var(--color-secondary-foreground);
    text-decoration: line-through;
    text-decoration-color: var(--color-tertiary-foreground);
  }

  .ui-files-changed-stats {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import type { ComponentProps, ReactNode } from "react";
import { join } from "./utils";

const fileIcon = (
  <svg viewBox="0 0 16 16" fill="none">
    <path
      d="M4 2.5h5l3 3v8a.5.5 0 0 1-.5.5h-7.5a.5.5 0 0 1-.5-.5v-10.5a.5.5 0 0 1 .5-.5zM9 2.5v3h3"
      stroke="currentColor"
      strokeWidth="1.25"
      strokeLinejoin="round"
    />
  </svg>
);

function Root({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-files-changed", className)} {...props} />;
}

function Header({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-files-changed-header", className)} {...props} />;
}

function Title({ className, ...props }: ComponentProps<"span">) {
  return <span className={join("ui-files-changed-title", className)} {...props} />;
}

function Additions({ className, children, ...props }: ComponentProps<"span">) {
  return (
    <span className={join("ui-files-changed-additions", className)} {...props}>
      +{children}
    </span>
  );
}

function Deletions({ className, children, ...props }: ComponentProps<"span">) {
  return (
    <span className={join("ui-files-changed-deletions", className)} {...props}>
      −{children}
    </span>
  );
}

function Actions({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-files-changed-actions", className)} {...props} />;
}

function List({ className, ...props }: ComponentProps<"ul">) {
  return <ul className={join("ui-files-changed-list", className)} {...props} />;
}

type FileProps = Omit<ComponentProps<"li">, "children"> & {
  path: string;
  icon?: ReactNode;
  change?: "added" | "modified" | "deleted" | "renamed";
  additions?: number;
  deletions?: number;
};

function File({ className, path, icon = fileIcon, change = "modified", additions, deletions, ...props }: FileProps) {
  const slash = path.lastIndexOf("/");
  return (
    <li className={join("ui-files-changed-file", className)} data-change={change} {...props}>
      <span className="ui-files-changed-icon" aria-hidden>
        {icon}
      </span>
      <span className="ui-files-changed-path">
        {slash === -1 ? null : <span className="ui-files-changed-directory">{path.slice(0, slash + 1)}</span>}
        <span className="ui-files-changed-name">{path.slice(slash + 1)}</span>
      </span>
      <span className="ui-files-changed-stats">
        {additions ? <Additions>{additions}</Additions> : null}
        {deletions ? <Deletions>{deletions}</Deletions> : null}
      </span>
    </li>
  );
}

export const FilesChanged = {
  Root,
  Header,
  Title,
  Additions,
  Deletions,
  Actions,
  List,
  File,
};
```

## Example

```tsx
import { Button, FilesChanged } from "@replicas/ui";

export default function FilesChangedDemo() {
  return (
    <FilesChanged.Root style={{ width: "100%", maxWidth: 520 }}>
      <FilesChanged.Header>
        <FilesChanged.Title>4 files changed</FilesChanged.Title>
        <FilesChanged.Additions>128</FilesChanged.Additions>
        <FilesChanged.Deletions>36</FilesChanged.Deletions>
        <FilesChanged.Actions>
          <Button variant="ghost" size="small">
            Undo
          </Button>
          <Button size="small">Review</Button>
        </FilesChanged.Actions>
      </FilesChanged.Header>
      <FilesChanged.List>
        <FilesChanged.File path="apps/web/app/settings/page.tsx" additions={64} deletions={12} />
        <FilesChanged.File path="apps/web/lib/billing.ts" additions={41} deletions={18} />
        <FilesChanged.File path="packages/db/migrations/0042_plans.sql" change="added" additions={23} />
        <FilesChanged.File path="apps/web/lib/legacy-billing.ts" change="deleted" deletions={6} />
      </FilesChanged.List>
    </FilesChanged.Root>
  );
}
```

## Foundations

The rest of the Interfere style, as a skill: https://replicas.raphaelsalaja.com/skills/interfere/SKILL.md