Irreversible Diff Badge

Marks fields that can't be changed back and, before save, lists only the permanent fields that actually changed, from → to.

StopsPermanent field changed without warning

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/irreversible-diff-badge.json

The files land in your project. They're yours to edit.

Usage

irreversible-diff-badge-usage.tsx
import { IrreversibleBadge, IrreversibleDiffSummary, type IrreversibleField } from "@/components/ui/irreversible-diff-badge"

Username <IrreversibleBadge severity="limited" changed={changed("username")} />

What it catches

  • Permanent or rarely changeable fields edited without notice
  • Readback of only the hard-to-undo fields that changed, with consequences
  • Confirmation given for one set of changes reused for another: it resets
  • One-tap Revert per field

Props

IrreversibleBadge props
PropTypeDefault
changed

Whether the field has been changed from its saved value. Unchanged shows a quiet lock; changed turns amber.

boolean—
severity

Same meaning as on IrreversibleField.

"permanent" | "limited""permanent"
messages

Visible strings.

Partial<Pick<IrreversibleMessages, "permanent" | "limited" | "changed">>—

* required. Also accepts the native props of <span> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Readback is a labelled group described by the change list
  • Changes are announced in a polite live region; from/to are read as text, with del/ins visuals aria-hidden
  • Revert buttons have aria-labels naming the field and old value; focus moves after a revert
  • Save errors use role=alert

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Enforce which fields are immutable on the server and audit-log changes to them.

  • You decide which fields are permanent; it can't know
  • Comparison uses your equals or a strict/JSON comparison

What it stops

Permanent field changed without warning

Also known as

username · slug · handle · permanent · readonly after save · profile settings · subdomain · diff

Field type

Dependencies

Pairs well with