Merge Records

Merge Records is a copy-paste React component that stops duplicate merge discarded customer data 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/merge-records
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

StopsDuplicate merge discarded customer data

Was this component page useful?

How do I install Merge Records?

pnpm dlx shadcn@latest add @bollard/merge-records

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

How do I use Merge Records in React?

merge-records-usage.tsx
import { MergeRecords, type MergeField, type MergeRecordItem } from "@/components/ui/merge-records"

<MergeRecords
  key={run}
  records={RECORDS}
  fields={FIELDS}
  formatDate={(d) => d.toLocaleDateString("en-GB", { day: "numeric", month: "short", timeZone: "UTC" })}
  onCancel={() => setRun((n) => n + 1)}
  onMerge={(result) =>
    new Promise<void>((resolve) =>
      setTimeout(() => {
        setDone(`Merged into ${result.survivorId}. ${result.discarded.length} values discarded.`)
        resolve()
      }, 600),
    )
  }
/>

What input mistakes does Merge Records catch?

  • Values that the merge will discard, listed by name
  • Real conflicts vs case/spacing differences
  • Which record keeps its ID
  • Links (deals, tickets, integrations) that move to the survivor

What props does Merge Records accept?

MergeRecords props
PropTypeDefault
records* (required)

The two or three duplicates. Order sets the A/B/C letters.

MergeRecordItem[]—
fields* (required)

Fields to compare, in display order.

MergeField[]—
value

Controlled picks. Defaults to the most recent non-empty value per field.

MergePicks—
defaultValue

Initial picks when uncontrolled.

MergePicks—
onValueChange

Called with the picks on every change.

(picks: MergePicks) => void—
defaultSurvivor

Record whose ID and links survive. Defaults to the one with the most links.

string—
onMerge* (required)

Runs with the result. Return a promise to show a pending state; a rejection is caught.

(result: { survivorId: string; removedIds: string[]; values: Record<string, string>; discarded: string[] }) => void | Promise<void>—
onCancel

Called when the user cancels.

() => void—
formatDate

Formats a record's updated date.

(date: Date) => string(d) => d.toLocaleDateString(undefined, { day: "numeric", …
conflictLabel

Label for a field whose values really differ.

string"Conflict"
agreeLabel

Label for the count of fields that agree.

(count: number) => string(n) => `${n} ${n === 1 ? "field agrees" : "fields agree"}`
survivorLabel

Label for the survivor choice.

string"Keep the ID and links of"
discardLabel

Label for the count of values discarded.

(count: number) => string(n) => `Discarded on merge (${n})`
nothingLostText

Shown when nothing will be discarded.

string"No values are lost."
irreversibleText

One honest line on reversibility.

string"Merging can't be undone."
mergeLabel

Merge button text from the count and survivor ID.

(count: number, survivorId: string) => string(n, id) => `Merge ${n} records into ${id}`
pendingLabel

Merge button text while merging.

string"Merging…"
cancelLabel

Cancel button text.

string"Cancel"

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

How is Merge Records accessible?

  • Per-field choices and the survivor are native radio inputs in labelled groups
  • Readback highlight animation is skipped under reduced motion
  • Icons are aria-hidden

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

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Run the merge in one transaction on the server and keep an audit record of discarded values.

  • Defaults by last-updated time, which isn't always the right value
  • Moves and deletes are done by your onMerge
  • One value per field; it can't combine lists

What expensive mistakes does Merge Records stop?

Duplicate merge discarded customer data

Also known as

merge duplicates · dedupe · crm · contacts · customer records · merge contacts · duplicate leads

Field type

What dependencies does Merge Records require?

Merge Records facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameMerge Records
Registry identifier@bollard/merge-records
Install commandnpx shadcn@latest add @bollard/merge-records
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 Merge Records

How does Merge Records protect destructive mutations?

Merge Records prevents duplicate merge discarded customer data. Enforces deliberate friction against Values that the merge will discard, listed by name, Real conflicts vs case/spacing differences, Which record keeps its ID, Links (deals, tickets, integrations) that move to the survivor. Limitation: authorize merge-records mutations on the server.

How do I install merge-records with shadcn?

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

What props customize Merge Records?

Merge Records accepts `records`, `fields`, `value`, `defaultValue`, `onValueChange`. Configures merge duplicates, dedupe, crm behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of merge-records?

Defaults by last-updated time, which isn't always the right value. Moves and deletes are done by your onMerge. One value per field; it can't combine lists Server requirement: Run the merge in one transaction on the server and keep an audit record of discarded values.

How does Merge Records meet accessibility guidelines?

Per-field choices and the survivor are native radio inputs in labelled groups. Readback highlight animation is skipped under reduced motion. Icons are aria-hidden. Minimizes errors: merge duplicates lost data, which contact id kept.

Which components pair with Merge Records?