Amount Input

Amount Input is a copy-paste React component that stops extra zero on a transfer 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/amount-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 3 extra npm packages
  • A11y guidance in docs

StopsExtra zero on a transfer

Was this component page useful?

How do I install Amount Input?

pnpm dlx shadcn@latest add @bollard/amount-input

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

How do I use Amount Input in React?

amount-input-usage.tsx
import { AmountInput } from "@/components/ui/amount-input"

<AmountInput
  label="Monthly rent"
  value={rent}
  onValueChange={(next, detail) => {
    setRent(next)
    setExact(detail?.decimal ?? "")
  }}
  typical={25000}
/>

What input mistakes does Amount Input catch?

  • An extra or missing zero, when the amount is `threshold`× (default 10) or more off the `typical` value you pass, with a one-tap fix that moves the zeros exactly
  • A paste in another locale's format ("1.250,50", "1.250.000", "12,5" in an en-IN field), by asking which reading you meant
  • Hard-to-read long numbers, by grouping digits as you type (Indian grouping for en-IN)
  • Misread amounts, by spelling the amount out in words
  • Leading zeros, and digits beyond `maxDigits` or the currency's precision, with a visible hint when digits are dropped

What props does Amount Input accept?

AmountInput props
PropTypeDefault
label

Visible label.

string"Amount"
value

Controlled amount: a number or an exact decimal string like "1250.50". `null` means empty.

number | string | null—
defaultValue

Initial amount when uncontrolled (number or decimal string).

number | string | nullnull
onValueChange

Called with the parsed number (or `null` when empty) and, when not empty, the exact decimal and minor-unit strings.

(value: number | null, detail?: AmountDetail) => void—
locale

BCP 47 locale used for grouping, e.g. `en-IN` for 12,34,567. Defaults to India.

string"en-IN"
currency

ISO 4217 currency code. Defaults to INR.

string"INR"
words

Number system for the amount in words, or `false` to hide it. Defaults to `indian` for `-IN` locales.

"indian" | "international" | false—
wordsFormatter

Builds the amount in words; defaults to English cheque style. Use it to translate.

(parts: AmountWordsParts) => stringdefaultAmountWords
typical

The usual amount for this field. Amounts `threshold`× above or below it get a warning.

number—
threshold

How many times off `typical` an amount must be to warn. Default 10.

number10
tooHighMessage

Warning text; `ratio` is like "16×", `usual` the formatted typical amount, `zeros` how many zeros it looks off by (0 when not a zero slip).

(ratio: string, usual: string, zeros: number) => string(ratio, usual, zeros) => `That's ${ratio} the usual ${usu…
tooLowMessage

Warning text when the amount is far below the usual one (`zeros` is negative or 0).

(ratio: string, usual: string, zeros: number) => string(ratio, usual, zeros) => `That's ${ratio} the usual ${usu…
fixLabel

Label of the one-tap fix; `amount` is the formatted fixed amount.

(amount: string) => string(amount) => `Use ${amount}`
maxDigits

Most digits accepted before the decimal point. Default 15.

number15
truncatedMessage

Hint shown when typed digits were dropped.

(kind: "digits" | "decimals", limit: number) => string(kind, limit) => kind === "digits" ? `Only ${limit} digit…
pasteMessage

Question shown when a paste could be read two ways.

(pasted: string) => string(pasted) => `You pasted "${pasted}". Which did you mean?`
showCurrencyCode

Show the ISO code after the field. Default true.

booleantrue
readback

Show the amount as an animated figure above the words, so a fix visibly drops or adds the zero. Default true.

booleantrue

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

How is Amount Input accessible?

  • Visible <label> tied to the input
  • aria-describedby lists only the words and notice elements that are currently rendered, plus any id you pass
  • Warnings, the truncation hint and the paste question are in an aria-live="polite" region; the fix and paste buttons return focus to the input
  • The animated read-back respects prefers-reduced-motion (motion's useReducedMotion)

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 amount and currency on the server, derive payable amounts from trusted data and use idempotency keys; this warning is a review prompt, not a correctness check.

  • The warning needs a `typical` amount; there is no fallback to a balance, limit or last amount
  • The number passed to onValueChange is a JavaScript float; use the second argument's `decimal` or `minor` string (or the hidden input's decimal string) for exact money maths
  • The paste check runs only when the paste replaces the whole field, and only for '.' and ',' separators
  • Default words are English ("Rupees … only", "paise", English unit names); pass `wordsFormatter` for other languages
  • No negative amounts
  • Defaults to en-IN and INR; set locale and currency for other markets

What expensive mistakes does Amount Input stop?

Extra zero on a transfer

Also known as

amount · money input · currency · rupees · ₹ · lakh crore · transfer · send money

Field type

What dependencies does Amount Input require?

Amount Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameAmount Input
Registry identifier@bollard/amount-input
Install commandnpx shadcn@latest add @bollard/amount-input
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)
Dependencies@number-flow/react, lucide-react, motion
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 Amount Input

How does Amount Input validate Indian financial identifiers?

Amount Input stops extra zero on a transfer. Complies with national standards for An extra or missing zero, when the amount is `threshold`× (default 10) or more off the `typical` value you pass, with a one-tap fix that moves the zeros exactly, A paste in another locale's format ("1.250,50", "1.250.000", "12,5" in an en-IN field), by asking which reading you meant, Hard-to-read long numbers, by grouping digits as you type (Indian grouping for en-IN), Misread amounts, by spelling the amount out in words, Leading zeros, and digits beyond `maxDigits` or the currency's precision, with a visible hint when digits are dropped. Limitation: verify amount-input with issuer gateway.

How do I install amount-input with shadcn?

Run `npx shadcn@latest add @bollard/amount-input`. Sources added: registry/default/amount-input/amount-input.tsx. Package requirements: @number-flow/react, lucide-react, motion.

What props customize Amount Input?

Amount Input accepts `label`, `value`, `defaultValue`, `onValueChange`, `locale`. Configures amount, money input, currency behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of amount-input?

The warning needs a `typical` amount; there is no fallback to a balance, limit or last amount. The number passed to onValueChange is a JavaScript float; use the second argument's `decimal` or `minor` string (or the hidden input's decimal string) for exact money maths. The paste check runs only when the paste replaces the whole field, and only for '.' and ',' separators. Default words are English ("Rupees … only", "paise", English unit names); pass `wordsFormatter` for other languages. No negative amounts. Defaults to en-IN and INR; set locale and currency for other markets Server requirement: Validate amount and currency on the server, derive payable amounts from trusted data and use idempotency keys; this warning is a review prompt, not a correctness check.

How does Amount Input meet accessibility guidelines?

Visible <label> tied to the input. aria-describedby lists only the words and notice elements that are currently rendered, plus any id you pass. Warnings, the truncation hint and the paste question are in an aria-live="polite" region; the fix and paste buttons return focus to the input. The animated read-back respects prefers-reduced-motion (motion's useReducedMotion). Minimizes errors: extra zero payment, amount in words.

Which components pair with Amount Input?