Match Field

Match Field is a copy-paste React component that stops mistyped confirm password or account number 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/match-field
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

StopsMistyped confirm password or account number

Was this component page useful?

How do I install Match Field?

pnpm dlx shadcn@latest add @bollard/match-field

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

How do I use Match Field in React?

match-field-usage.tsx
import { MatchField } from "@/components/ui/match-field"

<MatchField
  kind="account"
  defaultValue="50100234567812"
  defaultConfirmValue="50100234567182"
  hint="Digits only. It's hidden once you move on."
  onMatchChange={setReady}
/>

What input mistakes does Match Field catch?

  • Confirmation that differs from the first entry, with the mismatch position
  • Paste into the confirm box copied from the first box
  • Match state reported through onMatchChange

What props does Match Field accept?

MatchField props
PropTypeDefault
kind

`password` masks both entries; `account` is for bank account numbers (digits only, masked once you leave the field).

"password" | "account""password"
label

Label for the first entry.

stringkind === "account" ? "Account number" : "New password"
confirmLabel

Label for the confirmation entry.

stringkind === "account" ? "Re-enter account number" : "Confirm…
hint

Helper text under the first entry.

string—
value

Controlled value of the first entry.

string—
defaultValue

Initial value of the first entry when uncontrolled.

string""
defaultConfirmValue

Initial value of the confirmation entry, e.g. when restoring a draft form.

string""
onValueChange

Called with the first entry on every change.

(value: string) => void—
onMatchChange

Called whenever the two entries start or stop matching.

(matches: boolean) => void—
maskFirst

When to mask the first entry. Defaults to `always` for passwords and `blur` for accounts.

"always" | "blur" | "never"kind === "account" ? "blur" : "always"
blockPaste

`"copied"` (default) refuses paste or drop into the confirm field only when it is a copy of the first entry, so a typo can't be copied across while password managers and pasting from a saved source keep working (NIST…

boolean | "copied""copied"
name

Name of the first input, for native form submission.

string—
messages

Override any of the status texts.

Partial<MatchFieldMessages>—

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

How is Match Field accessible?

  • Both inputs have visible labels; the confirm box has aria-invalid on mismatch and is described by the status
  • Match status and paste notices are polite live regions
  • The position marker is aria-hidden; the status text says where it differs

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: Validate the account number or password again on the server; the match check is client-side only.

  • Only compares the two entries; it can't know the first one is what the user meant
  • Doesn't validate password strength or account-number checksums

What expensive mistakes does Match Field stop?

Mistyped confirm password or account number

Also known as

confirm password · re-enter · confirm account number · verify · signup · bank details · beneficiary · repeat field

What dependencies does Match Field require?

Match Field facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameMatch Field
Registry identifier@bollard/match-field
Install commandnpx shadcn@latest add @bollard/match-field
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 Match Field

How does Match Field validate Indian financial identifiers?

Match Field stops mistyped confirm password or account number. Complies with national standards for Confirmation that differs from the first entry, with the mismatch position, Paste into the confirm box copied from the first box, Match state reported through onMatchChange. Limitation: verify match-field with issuer gateway.

How do I install match-field with shadcn?

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

What props customize Match Field?

Match Field accepts `kind`, `label`, `confirmLabel`, `hint`, `value`. Configures confirm password, re-enter, confirm account number behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of match-field?

Only compares the two entries; it can't know the first one is what the user meant. Doesn't validate password strength or account-number checksums Server requirement: Validate the account number or password again on the server; the match check is client-side only.

How does Match Field meet accessibility guidelines?

Both inputs have visible labels; the confirm box has aria-invalid on mismatch and is described by the status. Match status and paste notices are polite live regions. The position marker is aria-hidden; the status text says where it differs. Minimizes errors: confirm password mismatch, re-enter account number.

Which components pair with Match Field?