Skip to content

DiffFileRow

Stable

One changed file in a review, with how much was added and removed, and buttons to keep or reject it.

Also known as changed file, file diff row

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Waiting, kept and rejected

12 lines added, 3 removed

Choose Keep or Reject to see the label. Undo puts the row back.

When to use it

One line per changed file, so people can see the size of each change and decide on the whole file in one step. After a choice the buttons become a labelled result, so the list shows what is settled.

Made of: File icon · File name (folder faded, name bold) · Counts (added, removed) · Keep and Reject buttons, or a result label · Partly kept label (when choices differ) · Undo (optional)

Use it for

  • A short list of changed files in a summary, with Keep and Reject for each.
  • A file list beside your own display of the changed lines.
  • Showing which files are kept, rejected or partly kept after a review.

Not for

  • Reviewing the changed lines themselves: use DiffView.
  • A file the person attached to a message: use AttachmentChip.

Do and avoid

12 lines added, 3 removed
Do. The file name, plus and minus counts, and both choices in one row.
invoice.ts12 3
Avoid. Counts shown only by color, and no Reject, leave people unsure.

Do

  • Show both counts, even when one is zero.
  • Keep the full file path available, since many files share a name.
  • Pass onReset if people should be able to change their mind. Without it, decided rows have no Undo.

Avoid

  • Don't show the counts with only color. Keep the plus and minus signs.
  • Don't hide Reject behind Keep. Show both until a choice is made.
  • Don't drop the file name to save space. Shorten the folder part instead.

On a phone

  • The file name takes the first line and is cut with an ellipsis, with the Keep and Reject buttons wrapping under it when the row is narrow.
  • Tapping the name selects the file, and every button has a 44px tap area on a touch screen.
  • The row highlight on hover is only decoration, so selection is shown without hover.

Seen in products

  • Cursor has a Review tab with a file list that shows +/- counts and per-file Keep and Reject (from a search snippet plus community threads).
  • Windsurf lets you accept or reject proposed modifications.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started