Approval Request with Blast Radius
The agent stops and asks: the effect stated before the verb, choices as radios in a fieldset so picking is separate from committing, no pre-focused Approve, and the decision left on screen afterwards.
Machine-proposed row edits accepted one at a time, with before and after in real del/ins elements, a tri-state select-all that actually sets indeterminate, and a running count of what will be written.
components/agent-diff-review.tsxnpx hoverlab add agent-diff-review
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
I filled gaps and corrected classifications from public sources. Row 4 is a guess from billing inactivity; the rest are verified.
| Record | Field | Change | |
|---|---|---|---|
| Northwind Retail | Industry | ||
| Vela Logistics | Employees | ||
| Harbour Foods | Owner | ||
| Pike & Sons | Status | ||
| Cobalt Interiors | Industry |
5 of 5 will be written
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
/**
* <AgentDiffReview> — proposed edits to tabular data, accepted or rejected
* row by row.
*
* When an agent rewrites forty rows, "apply all" is not a review, it is a
* shrug. This block makes the unit of consent the row, keeps a running count
* of what will actually be written, and shows before and after side by side
* rather than asking the user to remember the old value.
*
* The table is a real `<table>` with `<caption>`, scoped headers and one
* `<th scope="row">` per record, because a grid of divs is unnavigable with
* a screen reader's table commands — and reviewing a diff is exactly the
* task those commands exist for.
*
* Old values are wrapped in `<del>` and new ones in `<ins>`. Those elements
* are the semantic answer to "this changed", which colour and strikethrough
* styling alone never conveys — and `<ins>` takes a `cite`/`dateTime` in a
* real app, which is where the provenance of a machine edit belongs.
*
* The header checkbox is tri-state via `indeterminate`, a DOM property with
* no HTML attribute, so it has to be set through a ref. Getting this wrong
* is why most "select all" boxes read as unchecked while half the rows are
* selected.
*/
'use client'
import * as React from 'react'
import { Check, Sparkles, Undo2, X } from 'lucide-react'
export interface DiffRow {
id: string
record: string
field: string
before: string
after: string
/** Why the agent proposed this one. */
reason?: string
}
export interface AgentDiffReviewProps {
title?: string
summary?: string
rows?: DiffRow[]
className?: string
}
const DEFAULT_ROWS: DiffRow[] = [
{
id: '1',
record: 'Northwind Retail',
field: 'Industry',
before: 'Other',
after: 'Grocery & FMCG',
reason: 'Website and SIC code both say grocery',
},
{
id: '2',
record: 'Vela Logistics',
field: 'Employees',
before: '50-100',
after: '210',
reason: 'LinkedIn headcount, verified against last filing',
},
{
id: '3',
record: 'Harbour Foods',
field: 'Owner',
before: 'Unassigned',
after: 'D. Okafor',
reason: 'Territory rule: EMEA mid-market',
},
{
id: '4',
record: 'Pike & Sons',
field: 'Status',
before: 'Active',
after: 'Churned',
reason: 'No invoice in 240 days — low confidence, worth checking',
},
{
id: '5',
record: 'Cobalt Interiors',
field: 'Industry',
before: 'Retail',
after: 'Design & Architecture',
reason: 'Reclassified from site copy',
},
]
export function AgentDiffReview({
title = 'Proposed cleanup — 5 records',
summary = 'I filled gaps and corrected classifications from public sources. Row 4 is a guess from billing inactivity; the rest are verified.',
rows = DEFAULT_ROWS,
className = '',
}: AgentDiffReviewProps) {
// Starts fully selected: the agent is proposing, and a review that begins
// with everything off makes the user do the work twice.
const [accepted, setAccepted] = React.useState<string[]>(rows.map((r) => r.id))
const [applied, setApplied] = React.useState(false)
const all = accepted.length === rows.length
const none = accepted.length === 0
const selectAllRef = React.useRef<HTMLInputElement>(null)
React.useEffect(() => {
// `indeterminate` has no attribute — it exists only on the DOM node.
if (selectAllRef.current) selectAllRef.current.indeterminate = !all && !none
}, [all, none])
function toggle(id: string) {
setAccepted((list) => (list.includes(id) ? list.filter((x) => x !== id) : [...list, id]))
}
return (
<div className={`mx-auto w-full max-w-3xl p-6 ${className}`}>
<div className="overflow-hidden rounded-2xl border border-border/60 bg-card">
{/* -- Header ----------------------------------------------------- */}
<div className="flex items-start gap-3 border-b border-border/60 px-5 py-4">
<span className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
<Sparkles aria-hidden className="h-4 w-4" />
</span>
<div className="min-w-0">
{title ? <h3 data-stress-ignore className="text-sm font-semibold">{title}</h3> : null}
<p className="mt-1 text-xs leading-relaxed text-muted-foreground">{summary}</p>
</div>
</div>
{/* -- Diff table ------------------------------------------------- */}
<div className="overflow-x-auto">
<table className="w-full border-collapse text-sm">
<caption className="sr-only">
Proposed field changes, one row per record, each accepted or rejected individually
</caption>
<thead>
<tr className="border-b border-border/60 text-start">
<th scope="col" className="w-10 py-2.5 ps-5 pe-2">
<input
ref={selectAllRef}
type="checkbox"
checked={all}
onChange={() => setAccepted(all ? [] : rows.map((r) => r.id))}
aria-label="Accept every change"
className="h-4 w-4 accent-primary"
/>
</th>
<th scope="col" className="py-2.5 pe-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Record
</th>
<th scope="col" className="py-2.5 pe-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Field
</th>
<th scope="col" className="py-2.5 pe-5 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
Change
</th>
</tr>
</thead>
<tbody className="divide-y divide-border/40">
{rows.map((row) => {
const on = accepted.includes(row.id)
return (
<tr
key={row.id}
className={`transition-colors ${on ? '' : 'opacity-45'} hover:bg-muted/40`}
>
<td className="py-3 ps-5 pe-2 align-top">
<input
type="checkbox"
checked={on}
onChange={() => toggle(row.id)}
aria-label={`Accept ${row.field} change for ${row.record}`}
className="h-4 w-4 accent-primary"
/>
</td>
<th scope="row" className="py-3 pe-4 text-start align-top font-medium">
{row.record}
</th>
<td className="py-3 pe-4 align-top text-xs text-muted-foreground">
{row.field}
</td>
<td className="py-3 pe-5 align-top">
<span className="flex flex-wrap items-center gap-2">
<del className="rounded-md bg-rose-500/10 px-1.5 py-0.5 text-xs text-rose-600 decoration-rose-500/50 dark:text-rose-400">
{row.before}
</del>
<span aria-hidden className="text-muted-foreground">
→
</span>
<ins className="rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-xs font-medium text-emerald-700 no-underline dark:text-emerald-400">
{row.after}
</ins>
</span>
{row.reason ? (
<span className="mt-1 block text-xs text-muted-foreground">
{row.reason}
</span>
) : null}
</td>
</tr>
)
})}
</tbody>
</table>
</div>
{/* -- Apply bar --------------------------------------------------- */}
<div className="flex flex-wrap items-center gap-3 border-t border-border/60 bg-muted/30 px-5 py-3">
{/* The count is the whole safety mechanism: it is what stops
"apply" from meaning something different than it looks. */}
<p role="status" className="text-sm text-muted-foreground">
{applied ? (
<span className="font-medium text-foreground">
Applied {accepted.length} {accepted.length === 1 ? 'change' : 'changes'}.{' '}
{rows.length - accepted.length} discarded.
</span>
) : (
<>
<span className="font-medium text-foreground">{accepted.length}</span> of{' '}
{rows.length} will be written
</>
)}
</p>
<div className="ms-auto flex items-center gap-2">
{applied ? (
<button
type="button"
onClick={() => setApplied(false)}
className="inline-flex items-center gap-1.5 rounded-xl border border-border/60 px-3.5 py-2 text-sm font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<Undo2 aria-hidden className="h-4 w-4 rtl:rotate-180" />
Undo
</button>
) : (
<>
<button
type="button"
onClick={() => setAccepted([])}
className="inline-flex items-center gap-1.5 rounded-xl border border-border/60 px-3.5 py-2 text-sm font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<X aria-hidden className="h-4 w-4" />
Reject all
</button>
<button
type="button"
disabled={none}
onClick={() => setApplied(true)}
className="inline-flex items-center gap-1.5 rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
<Check aria-hidden className="h-4 w-4" />
Apply {accepted.length}
</button>
</>
)}
</div>
</div>
</div>
</div>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/agent-diff-review.tsx and import it where you need the section:
import { AgentDiffReview } from '@/components/agent-diff-review'1 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.
Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
title | string | 'Proposed cleanup — 5 records' |
summary | string | — |
rows | DiffRow[] | DEFAULT_ROWS |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.
<!--
Proposed Edits Diff Table — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block is interactive in React and the handlers are NOT here.
Buttons, toggles and menus render in their initial state and do
nothing until you wire them up.
-->
<div class="mx-auto w-full max-w-3xl p-6 ">
<div class="overflow-hidden rounded-2xl border border-border/60 bg-card">
<div class="flex items-start gap-3 border-b border-border/60 px-5 py-4">
<span class="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles h-4 w-4" aria-hidden="true">
<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"></path>
<path d="M20 3v4"></path>
<path d="M22 5h-4"></path>
<path d="M4 17v2"></path>
<path d="M5 18H3"></path>
</svg>
</span>
<div class="min-w-0">
<h3 data-stress-ignore="true" class="text-sm font-semibold">Proposed cleanup — 5 records</h3>
<p class="mt-1 text-xs leading-relaxed text-muted-foreground">I filled gaps and corrected classifications from public sources. Row 4 is a guess from billing inactivity; the rest are verified.</p>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full border-collapse text-sm">
<caption class="sr-only">Proposed field changes, one row per record, each accepted or rejected individually</caption>
<thead>
<tr class="border-b border-border/60 text-start">
<th scope="col" class="w-10 py-2.5 ps-5 pe-2">
<input type="checkbox" aria-label="Accept every change" class="h-4 w-4 accent-primary" checked="" />
</th>
<th scope="col" class="py-2.5 pe-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground">Record</th>
<th scope="col" class="py-2.5 pe-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground">Field</th>
<th scope="col" class="py-2.5 pe-5 text-xs font-semibold uppercase tracking-wider text-muted-foreground">Change</th>
</tr>
</thead>
<tbody class="divide-y divide-border/40">
<tr class="transition-colors hover:bg-muted/40">
<td class="py-3 ps-5 pe-2 align-top">
<input type="checkbox" aria-label="Accept Industry change for Northwind Retail" class="h-4 w-4 accent-primary" checked="" />
</td>
<th scope="row" class="py-3 pe-4 text-start align-top font-medium">Northwind Retail</th>
<td class="py-3 pe-4 align-top text-xs text-muted-foreground">Industry</td>
<td class="py-3 pe-5 align-top">
<span class="flex flex-wrap items-center gap-2">
<del class="rounded-md bg-rose-500/10 px-1.5 py-0.5 text-xs text-rose-600 decoration-rose-500/50 dark:text-rose-400">Other</del>
<span aria-hidden="true" class="text-muted-foreground">→</span>
<ins class="rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-xs font-medium text-emerald-700 no-underline dark:text-emerald-400">Grocery & FMCG</ins>
</span>
<span class="mt-1 block text-xs text-muted-foreground">Website and SIC code both say grocery</span>
</td>
</tr>
<tr class="transition-colors hover:bg-muted/40">
<td class="py-3 ps-5 pe-2 align-top">
<input type="checkbox" aria-label="Accept Employees change for Vela Logistics" class="h-4 w-4 accent-primary" checked="" />
</td>
<th scope="row" class="py-3 pe-4 text-start align-top font-medium">Vela Logistics</th>
<td class="py-3 pe-4 align-top text-xs text-muted-foreground">Employees</td>
<td class="py-3 pe-5 align-top">
<span class="flex flex-wrap items-center gap-2">
<del class="rounded-md bg-rose-500/10 px-1.5 py-0.5 text-xs text-rose-600 decoration-rose-500/50 dark:text-rose-400">50-100</del>
<span aria-hidden="true" class="text-muted-foreground">→</span>
<ins class="rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-xs font-medium text-emerald-700 no-underline dark:text-emerald-400">210</ins>
</span>
<span class="mt-1 block text-xs text-muted-foreground">LinkedIn headcount, verified against last filing</span>
</td>
</tr>
<tr class="transition-colors hover:bg-muted/40">
<td class="py-3 ps-5 pe-2 align-top">
<input type="checkbox" aria-label="Accept Owner change for Harbour Foods" class="h-4 w-4 accent-primary" checked="" />
</td>
<th scope="row" class="py-3 pe-4 text-start align-top font-medium">Harbour Foods</th>
<td class="py-3 pe-4 align-top text-xs text-muted-foreground">Owner</td>
<td class="py-3 pe-5 align-top">
<span class="flex flex-wrap items-center gap-2">
<del class="rounded-md bg-rose-500/10 px-1.5 py-0.5 text-xs text-rose-600 decoration-rose-500/50 dark:text-rose-400">Unassigned</del>
<span aria-hidden="true" class="text-muted-foreground">→</span>
<ins class="rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-xs font-medium text-emerald-700 no-underline dark:text-emerald-400">D. Okafor</ins>
</span>
<span class="mt-1 block text-xs text-muted-foreground">Territory rule: EMEA mid-market</span>
</td>
</tr>
<tr class="transition-colors hover:bg-muted/40">
<td class="py-3 ps-5 pe-2 align-top">
<input type="checkbox" aria-label="Accept Status change for Pike &amp; Sons" class="h-4 w-4 accent-primary" checked="" />
</td>
<th scope="row" class="py-3 pe-4 text-start align-top font-medium">Pike & Sons</th>
<td class="py-3 pe-4 align-top text-xs text-muted-foreground">Status</td>
<td class="py-3 pe-5 align-top">
<span class="flex flex-wrap items-center gap-2">
<del class="rounded-md bg-rose-500/10 px-1.5 py-0.5 text-xs text-rose-600 decoration-rose-500/50 dark:text-rose-400">Active</del>
<span aria-hidden="true" class="text-muted-foreground">→</span>
<ins class="rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-xs font-medium text-emerald-700 no-underline dark:text-emerald-400">Churned</ins>
</span>
<span class="mt-1 block text-xs text-muted-foreground">No invoice in 240 days — low confidence, worth checking</span>
</td>
</tr>
<tr class="transition-colors hover:bg-muted/40">
<td class="py-3 ps-5 pe-2 align-top">
<input type="checkbox" aria-label="Accept Industry change for Cobalt Interiors" class="h-4 w-4 accent-primary" checked="" />
</td>
<th scope="row" class="py-3 pe-4 text-start align-top font-medium">Cobalt Interiors</th>
<td class="py-3 pe-4 align-top text-xs text-muted-foreground">Industry</td>
<td class="py-3 pe-5 align-top">
<span class="flex flex-wrap items-center gap-2">
<del class="rounded-md bg-rose-500/10 px-1.5 py-0.5 text-xs text-rose-600 decoration-rose-500/50 dark:text-rose-400">Retail</del>
<span aria-hidden="true" class="text-muted-foreground">→</span>
<ins class="rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-xs font-medium text-emerald-700 no-underline dark:text-emerald-400">Design & Architecture</ins>
</span>
<span class="mt-1 block text-xs text-muted-foreground">Reclassified from site copy</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex flex-wrap items-center gap-3 border-t border-border/60 bg-muted/30 px-5 py-3">
<p role="status" class="text-sm text-muted-foreground"><span class="font-medium text-foreground">5</span> of 5 will be written</p>
<div class="ms-auto flex items-center gap-2">
<button type="button" class="inline-flex items-center gap-1.5 rounded-xl border border-border/60 px-3.5 py-2 text-sm font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x h-4 w-4" aria-hidden="true"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>Reject all</button>
<button type="button" class="inline-flex items-center gap-1.5 rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check h-4 w-4" aria-hidden="true"><path d="M20 6 9 17l-5-5"></path></svg>Apply 5</button>
</div>
</div>
</div>
</div>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse Human in the LoopCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
The agent stops and asks: the effect stated before the verb, choices as radios in a fieldset so picking is separate from committing, no pre-focused Approve, and the decision left on screen afterwards.
A suggestion scored with a native meter rather than a styled bar, banded in words as well as numbers, and showing what the model rejected — the fastest way a human catches a bad recommendation.
Read and write scopes separated rather than bundled, writes off by default, a required expiry, and switches that are real checkboxes with role="switch" — so the grant is toggleable by keyboard and announced as on or off.
Forty decisions and an honest way to clear them: bulk approve that cannot reach the high-impact rows, a select-all that says how many it takes, and the auto-approve deadline on every line.
Which agent actions run unattended and which need a signature, stated as a policy the operator can read before anything happens.
What is waiting on a person, ordered by how long it has been waiting rather than when it arrived.
Where a person sits in an automated run, written as four guarantees rather than as a promise that a human is involved.