Skip to content
CodeChanged filesMenu

Changed files

The files an agent changed, with status letters, dimmed directories, +/- counts and a five-cell bar. Selecting a file opens its diff.

Status letters, dimmed directories, counts and the five-cell bar, with one file reviewed.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/changed-files.json

Usage

tsx
import { ChangedFiles } from "@/components/ui/chatcn/changed-files"

<ChangedFiles files={files} value={path} onValueChange={setPath} />

A DiffFile from chatcn-diff fits as is. Any object with path, status, additions and deletions works too. Pass reviewed with the paths whose hunks all have a decision, and they trade the bar for a check.

Examples

States

Loading skeleton, nothing changed, and long paths with large counts.

Props

PropTypeNotes
filesChangedFile[]{ path, oldPath?, status, additions, deletions }
value, defaultValue, onValueChangestringThe selected path. Defaults to the first file
titleReactNodeDefaults to "Review changes". null hides the header
actionsReactNodeControls at the end of the header
reviewedstring[]Paths that are done
loadingbooleanSkeleton rows in the final layout
variant"plain" | "card"Defaults to plain

Status letters

LetterMeaningBadge
AAddedGreen tint
MModifiedAmber tint
RRenamedBlue tint, the old path in the tooltip
DDeletedRed tint, and the path steps back

Keyboard

KeyAction
ArrowDown, JNext file
ArrowUp, KPrevious file
Home, EndFirst or last file
Enter, SpaceSelect the focused file

Accessibility

  • A listbox of options with roving focus. Selection follows focus, like tabs, so the diff beside it updates as you move.
  • Status letters carry a hidden word (Added, Deleted) and counts read as 12 added, 3 removed. The bar is decorative.
  • Rows are 44 px tall on touch screens.

Motion

  • Hover and selection change background color in 150 ms. Keyboard moves are instant.