Diff Table
ProNewA reviewable set of edits from an agent: old value struck out, new value beside it, accept row by row.
Installation
pnpm dlx shadcn@latest add @viewport/diff-table
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| title* | stringWhat the changes are for, e.g. "Update customer record". | — |
| changes* | DiffChange[] | — |
| defaultSelected | string[]Ids ticked at the start. Defaults to every change. | — |
| onApply | (ids: string[]) => voidCalled with the ids of the accepted changes. | — |
| onDiscard | () => voidCalled when the proposal is dismissed. Omit to hide the button. | — |
| className | string | — |
Accessibility
- A real table: each field is a row header and labels its checkbox.
- Old and new values are del and ins elements.
- Select all reports a mixed state; the outcome is announced as a status.