Diff Table

Diff Table is a copy-paste React component that stops picked the wrong plan from a comparison before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/diff-table
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsPicked the wrong plan from a comparison

Was this component page useful?

How do I install Diff Table?

pnpm dlx shadcn@latest add @bollard/diff-table

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

How do I use Diff Table in React?

diff-table-usage.tsx
import { DiffTable, type DiffColumn, type DiffRow } from "@/components/ui/diff-table"

return <DiffTable columns={columns} rows={rows} caption="Plan comparison" defaultDifferencesOnly className="max-w-lg" />

What input mistakes does Diff Table catch?

  • Real differences hidden among identical rows
  • Formatting-only differences that aren't real (case, spaces, units spacing)
  • Blank cells that would be read as "No"

What props does Diff Table accept?

DiffTable props
PropTypeDefault
columns* (required)

The things being compared, left to right.

DiffColumn[]—
rows* (required)

The attributes, top to bottom.

DiffRow[]—
differencesOnly

Controlled "show only differences" state.

boolean—
defaultDifferencesOnly

Initial state when uncontrolled.

booleanfalse
onDifferencesOnlyChange

Called when the toggle changes.

(differencesOnly: boolean) => void—
caption

Accessible caption of the table.

string"Comparison"
toggleLabel

Label of the toggle.

string"Show only differences"
missingLabel

Text in a cell with no value.

string"Not stated"
missingNote

Note under a row with missing values. Receives the column labels that are missing.

(columns: string) => string(names) => `Not stated for ${names}. Don’t read it as “No”.`
yesLabel

Screen reader text for `true` and `false`.

string"Included"
noLabel

Text read for a No cell.

string"Not included"
hiddenNote

Line under a filtered table. Receives how many identical rows are hidden.

(count: number) => string(count) => `${count} identical ${count === 1 ? "row" : "r…
sameCountLabel

Count beside the toggle. Receives how many rows are identical.

(count: number) => string(count) => `(${count} same)`
showAllLabel

Button that turns the filter off. Receives the total number of rows.

(count: number) => string(count) => `Show all ${count}`
differsLabel

Screen reader text after a value that stands out.

string"(differs)"
locale

When set, numbers in cells are formatted for this locale (1000 → "1,000"). Left unset they print as given.

string—

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

How is Diff Table accessible?

  • A real <table> with a <caption>
  • The filter is a role="switch" with aria-checked
  • Yes/No cells use text plus icons; differing cells say so in text
  • The hidden-rows note is aria-live="polite"

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

What are the limitations and server boundaries?

  • Normalisation is simple; values that mean the same in different words still show as different
  • Rows with blank cells stay visible even when showing only differences

What expensive mistakes does Diff Table stop?

Picked the wrong plan from a comparison

Also known as

comparison table · pricing table · compare plans · product compare · spec sheet · differences · feature matrix · pricing

What dependencies does Diff Table require?

Diff Table facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDiff Table
Registry identifier@bollard/diff-table
Install commandnpx shadcn@latest add @bollard/diff-table
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Diff Table

How does Diff Table prevent financial transaction errors?

Diff Table prevents picked the wrong plan from a comparison. Blocks Real differences hidden among identical rows, Formatting-only differences that aren't real (case, spaces, units spacing), Blank cells that would be read as "No" before processing. Limitation: apply idempotency keys for diff-table.

How do I install diff-table with shadcn?

Run `npx shadcn@latest add @bollard/diff-table`. Sources added: registry/default/diff-table/diff-table.tsx. Package requirements: lucide-react.

What props customize Diff Table?

Diff Table accepts `columns`, `rows`, `differencesOnly`, `defaultDifferencesOnly`, `onDifferencesOnlyChange`. Configures comparison table, pricing table, compare plans behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of diff-table?

Normalisation is simple; values that mean the same in different words still show as different. Rows with blank cells stay visible even when showing only differences Server requirement: backend verification for diff-table.

How does Diff Table meet accessibility guidelines?

A real <table> with a <caption>. The filter is a role="switch" with aria-checked. Yes/No cells use text plus icons; differing cells say so in text. The hidden-rows note is aria-live="polite". Minimizes errors: comparison table confusing, show only differences.

Which components pair with Diff Table?