AI
DiffTable
Control proposed additions/removals with stable row IDs and selectedIds. Apply/Reject only return selected IDs; success appears only after the host supplies applied. Busy/disabled lock actions; error/cancelled retain data and the host decides how to retry.
Control proposed additions/removals with stable row IDs and selectedIds. Apply/Reject only return selected IDs; success appears only after the host supplies applied. Busy/disabled lock actions; error/cancelled retain data and the host decides how to retry.
Import
tsx1 line
import { DiffTable } from "@yuhuanowo/yunui/ai";Interactive example
The controls below explicitly simulate host responses; no request is sent. All labels and accessibility copy can be overridden. Missing callbacks disable the corresponding request controls.
DiffTable
Proposed changesSelect the changes to apply
| Item | Category | Details |
|---|---|---|
| Replace duplicate controls | Chat | Conversation view |
| Use public components | Library | Public imports |
1 removal · 1 addition
No changes have been applied.
Composition
tsx3 linesScroll horizontally
import { DiffTable } from "@yuhuanowo/yunui/ai";
<DiffTable rows={[{ id: "add", primary: "Use public imports", category: "Chat", secondary: "Conversation", change: "add" }]} selectedIds={["add"]} state="idle" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | |
| labels | DiffTableLabels | — | |
| onApply | ((selectedIds: readonly string[]) => void) | — | Host callbacks; the component never marks a request successful itself. |
| onReject | ((selectedIds: readonly string[]) => void) | — | |
| onSelectionChange | ((selectedIds: readonly string[]) => void) | — | |
| resultCount | number | — | Use when the host clears `selectedIds` after apply but wants to retain result count. |
| rows* | readonly DiffTableRow[] | — | |
| selectedIds* | readonly string[] | — | Controlled IDs for included additions/removals. |
| state | "idle" | "busy" | "applied" | "error" | "cancelled" | "disabled" | idle | |
| statusMessage | ReactNode | — | Optional host-rendered request detail for non-idle states. |