Tab Collision

Tab Collision is a copy-paste React component that stops second tab save erased edits 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/tab-collision
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

StopsSecond tab save erased edits

Was this component page useful?

How do I install Tab Collision?

pnpm dlx shadcn@latest add @bollard/tab-collision

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

How do I use Tab Collision in React?

tab-collision-usage.tsx
import { TabCollision } from "@/components/ui/tab-collision"

<TabCollision recordId="demo-invoice-1042" dirty={amount !== "48,500.00"}>
  <label className="grid gap-1.5 text-sm font-medium">
    Amount (₹)
    <input value={amount} onChange={(event) => setAmount(event.target.value)} inputMode="decimal" className={field} />
  </label>
</TabCollision>

What input mistakes does Tab Collision catch?

  • The same record open for editing in another tab of this browser
  • Taking over while the other tab has unsaved changes (confirm first)
  • Status changes reported through onStatusChange

What props does Tab Collision accept?

TabCollision props
PropTypeDefault
recordId* (required)

Identifies the record; tabs editing different records never collide.

string—
dirty

Whether this tab has unsaved changes. A newer tab won't take over a dirty one without asking.

booleanfalse
onStatusChange

Called whenever this tab gains or loses the right to edit.

(status: TabStatus) => void—
message

Shown when another tab is editing.

string"Open in another tab. Editing is paused here so the two c…
dirtyMessage

Shown when the other tab has unsaved changes.

string"Open in another tab with unsaved changes. Editing is pau…
confirmMessage

Confirmation before taking over.

string"The other tab keeps its unsaved changes but becomes read…
takeOverLabel

Label of the Use-this-tab button.

string"Use this tab"
confirmLabel

Label of the confirm-take-over button.

string"Take over anyway"
cancelLabel

Label of the Cancel button.

string"Cancel"
regionLabel

Accessible name of the notice.

string"Open in another tab"

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

How is Tab Collision accessible?

  • Notice is a region with an aria-label; message in a polite live region
  • Confirm step closes with Escape
  • Buttons have text labels; 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: Use optimistic concurrency (version or ETag) on save so concurrent edits from anywhere are rejected, not overwritten.

  • Same browser profile only; other devices, browsers or users are not seen
  • Read-only mode is up to you to apply using the status
  • Does not merge edits

What expensive mistakes does Tab Collision stop?

Second tab save erased edits

Also known as

multiple tabs · broadcastchannel · concurrent edit · conflict · read only · edit lock · cross-tab

What dependencies does Tab Collision require?

Tab Collision facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameTab Collision
Registry identifier@bollard/tab-collision
Install commandnpx shadcn@latest add @bollard/tab-collision
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-11-15
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 Tab Collision

What form validation mistake does Tab Collision catch?

Tab Collision prevents second tab save erased edits. Lets only one browser tab edit a record at a time, so a save in one tab doesn't silently erase edits in another. Catches: The same record open for editing in another tab of this browser, Taking over while the other tab has unsaved changes (confirm first), Status changes reported through onStatusChange. Limitation: validate tab-collision schemas on backend.

How do I install tab-collision with shadcn?

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

What props customize Tab Collision?

Tab Collision accepts `recordId`, `dirty`, `onStatusChange`, `message`, `dirtyMessage`. Configures multiple tabs, broadcastchannel, concurrent edit behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of tab-collision?

Same browser profile only; other devices, browsers or users are not seen. Read-only mode is up to you to apply using the status. Does not merge edits Server requirement: Use optimistic concurrency (version or ETag) on save so concurrent edits from anywhere are rejected, not overwritten.

How does Tab Collision meet accessibility guidelines?

Notice is a region with an aria-label; message in a polite live region. Confirm step closes with Escape. Buttons have text labels; icons are aria-hidden. Minimizes errors: edited in two tabs, last save overwrote changes.

Which components pair with Tab Collision?