IFSC Input

Catches IFSC typos like the letter O for the fixed zero, then reads the branch back so a transfer doesn't go to the wrong bank or branch.

StopsHelps prevent a transfer to the wrong branch

Installation

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

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

Usage

ifsc-input-usage.tsx
import { IfscInput, type IfscDetails } from "@/components/ui/ifsc-input"

<IfscInput value={ifsc} onValueChange={setIfsc} lookup={lookup} expectedBank={bank} onUseBank={(_, name) => setBank(name)} requiredRail="RTGS" />

What it catches

  • Letter O typed for the fifth character, which is always 0
  • Missing 0, wrong length, or digits in the 4-letter bank code
  • Prefixes guessed from the bank name (AXIS instead of UTIB)
  • Branch from the lookup belonging to a different bank than the one chosen
  • Branch that doesn't support a required rail (requiredRail)

Props

IfscInput props
PropTypeDefault
label

Visible label.

string"IFSC"
value

Controlled IFSC (cleaned and uppercased).

string—
defaultValue

Initial IFSC when uncontrolled.

string""
onValueChange

Called with the cleaned, uppercased code on every change.

(value: string) => void—
lookup

Finds the branch for a complete code. Resolve null when it doesn't exist. See createRazorpayIfscLookup.

(ifsc: string, signal: AbortSignal) => Promise<IfscDetails | null>—
onDetailsChange

Called with the branch once found, or null when the code changes or isn't found.

(details: IfscDetails | null) => void—
expectedBank

The bank the user picked earlier in the form (name or 4-letter code), compared with the IFSC's bank.

string—
onUseBank

Offers a one-tap switch of the picked bank when it doesn't match the IFSC.

(bankCode: string, bankName: string) => void—
requiredRail

A payment rail this transfer needs; warns when the branch doesn't support it.

IfscRail—
mismatchMessage

Text after the IFSC's bank in the mismatch warning, before the picked bank.

string"but you picked"
notFoundMessage

Shown when the lookup finds no branch.

string"No branch has this IFSC."

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

Accessibility

  • Visible label tied to the input, described by a polite status region
  • aria-invalid when the lookup finds no branch
  • Lookup failures use role=alert with a retry button
  • Icons are aria-hidden; warnings are text

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: Re-validate the IFSC and run payee name verification on the server before initiating the transfer.

  • Format looks valid is not the same as verified; only your lookup confirms the branch exists
  • Built-in bank prefix list is partial
  • Doesn't check the account number or the payee name

Rules

Rules last verified:

Informational; check the official source. Format rule confirmed. The guessed-prefix list and the Razorpay API shape were not re-verified. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Helps prevent a transfer to the wrong branch

Also known as

ifsc · ifsc code · bank branch · neft · rtgs · imps · beneficiary · bank details

Field type

Dependencies

Pairs well with