Join Preview

Join Preview is a copy-paste React component that stops sql join duplicated every row 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/join-preview
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

StopsSQL join duplicated every row

Was this component page useful?

How do I install Join Preview?

pnpm dlx shadcn@latest add @bollard/join-preview

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

How do I use Join Preview in React?

join-preview-usage.tsx
import { JoinPreview } from "@/components/ui/join-preview"

<JoinPreview
  left={{ name: "orders", rows: orders }}
  right={{ name: "customers", rows: customers }}
  leftOn="customer_id"
  rightOn="id"
  expect="m:1"
  onJoin={() => new Promise((resolve) => setTimeout(resolve, 600))}
/>

What input mistakes does Join Preview catch?

  • Repeated keys that fan rows out (and break an expected m:1)
  • Rows dropped for having no match or a blank key
  • Keys that differ only by type: number vs text
  • Keys that differ by spaces, case or leading zeros
  • Row count for inner, left, right and outer joins side by side

What props does Join Preview accept?

JoinPreview props
PropTypeDefault
left* (required)

Left table: a display name and its rows.

{ name: string; rows: JoinRow[] }—
right* (required)

Right table: a display name and its rows.

{ name: string; rows: JoinRow[] }—
leftOn* (required)

Key column(s) on the left.

string | string[]—
rightOn

Key column(s) on the right. Defaults to `leftOn`.

string | string[]—
how

Controlled join type.

JoinHow—
defaultHow

Initial join type when uncontrolled.

JoinHow"left"
onHowChange

Called when the user picks a join type.

(how: JoinHow) => void—
normalize

Controlled key normalisation.

JoinNormalize—
defaultNormalize

Initial key normalisation when uncontrolled.

JoinNormalize{}
onNormalizeChange

Called when the user toggles a key normalisation.

(normalize: JoinNormalize) => void—
expect

Cardinality you expect. Breaking it turns the fan-out warning red.

JoinCardinality—
onJoin

Runs the join. May return a Promise; the button shows a pending state.

(plan: { how: JoinHow; normalize: JoinNormalize }) => void | Promise<unknown>—
locale

Locale for numbers.

string—
messages

Every visible string, with `{placeholders}`.

Partial<JoinPreviewMessages>—

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

How is Join Preview accessible?

  • Section is labelled with both table names
  • Join type is a radiogroup with roving tabindex, arrow keys, Home and End
  • Counts are in a polite live region; failures use role=alert
  • Run button shows aria-busy while pending

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

What are the limitations and server boundaries?

  • Runs on the sample rows you pass, in the browser; large tables need a server-side count
  • Normalisations are opt-in and may merge keys that really are different
  • Predicts counts; it doesn't run your SQL or know your database's collation and type coercion

What expensive mistakes does Join Preview stop?

SQL join duplicated every row

Also known as

sql join · left join · inner join · merge · pandas merge · vlookup · data pipeline · etl

Field type

What dependencies does Join Preview require?

Join Preview facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameJoin Preview
Registry identifier@bollard/join-preview
Install commandnpx shadcn@latest add @bollard/join-preview
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 Join Preview

What form validation mistake does Join Preview catch?

Join Preview prevents sQL join duplicated every row. Predicts a join's row count before it runs, so repeated keys that duplicate rows or keys that never match don't go unnoticed. Catches: Repeated keys that fan rows out (and break an expected m:1), Rows dropped for having no match or a blank key, Keys that differ only by type: number vs text, Keys that differ by spaces, case or leading zeros, Row count for inner, left, right and outer joins side by side. Limitation: validate join-preview schemas on backend.

How do I install join-preview with shadcn?

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

What props customize Join Preview?

Join Preview accepts `left`, `right`, `leftOn`, `rightOn`, `how`. Configures sql join, left join, inner join behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of join-preview?

Runs on the sample rows you pass, in the browser; large tables need a server-side count. Normalisations are opt-in and may merge keys that really are different. Predicts counts; it doesn't run your SQL or know your database's collation and type coercion Server requirement: backend verification for join-preview.

How does Join Preview meet accessibility guidelines?

Section is labelled with both table names. Join type is a radiogroup with roving tabindex, arrow keys, Home and End. Counts are in a polite live region; failures use role=alert. Run button shows aria-busy while pending. Minimizes errors: join duplicates rows, rows missing after join.

Which components pair with Join Preview?