Checksum Input

Checks IBAN, card and ISBN check digits as you type and points to the swapped or doubled character, so money and orders don't go to a mistyped number.

StopsMoney sent to a mistyped account

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/checksum-input.json

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

Usage

checksum-input-usage.tsx
import { ChecksumInput } from "@/components/ui/checksum-input"

<ChecksumInput kind="iban" label="Payee IBAN" defaultValue="DE89 3704 0044 0523 0130 00" />

What it catches

  • IBAN mod-97 failures and wrong length for the country
  • Card numbers failing Luhn or with a wrong length for the brand
  • ISBN-10/13 check digit failures
  • IFSC codes in the wrong format, with known bank codes read back
  • The swapped or doubled character that explains a failure

Props

ChecksumInput props
PropTypeDefault
kind* (required)

What the field holds.

ChecksumKind—
label

Visible label. Defaults to the kind's name.

stringLABELS[kind]
value

Controlled value, without spaces.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the cleaned value (no spaces, upper case).

(value: string) => void—
hint

Helper text shown while there is nothing to report.

string—
locale

Locale for IBAN country names.

string"en"
messages

Override any of the default messages.

Partial<typeof CHECKSUM_MESSAGES>—

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

Accessibility

  • Visible <label>; aria-invalid and aria-describedby to an aria-live="polite" status
  • Fix returns focus to the input
  • Grouped read-back is aria-hidden; status text carries the result

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

Limitations

This is a UX guard rail. Enforce on the server: Validate the account or card with the bank or payment processor before moving money.

  • A passing check digit means the number is well-formed, not that the account, card or book exists
  • IFSC has no check digit: only format and a few bank codes are checked
  • The IBAN length table needs updating when countries join the registry

What it stops

Money sent to a mistyped account

Also known as

iban · card number · luhn · isbn · ifsc · mod 97 · check digit · bank details

Field type

Dependencies

Pairs well with