---
title: "AmountInput"
description: "The hardest input in fintech."
canonical: "https://lopifi.com/components/amount-input"
---

# AmountInput

> The hardest input in fintech.

Source: https://lopifi.com/components/amount-input
Part of: Lopifi — Your VC tech stack partner (https://lopifi.com)

---

- **Family:** Payments — 
- **Status:** Implemented
- **Spec:** https://lopifi.com/docs/catalog/payments

## Install

```bash
npx shadcn@latest add @lopifi/theme
npx shadcn@latest add @lopifi/amount-input
```

## Specification

> The hardest input in fintech. If this is wrong, nothing else matters.

```tsx
<AmountInput
  currency="USD"
  value={amount}
  onChange={setAmount}
  max={availableBalance}
  onMaxClick={() => setAmount(availableBalance)}
/>
```

### The rules

- **`type="text"` + `inputMode="decimal"`.** Never `type="number"`. Its scroll wheel increments the value (and *will* silently change someone's payment), it parses decimals differently by locale, and its spinners can't be styled.
- **16px minimum font size** or iOS Safari zooms the viewport on focus and never zooms back.
- **Parse permissively, format on blur.** Accept `1,234.56`, `1234,56`, `1 234.56`, `$1234.56`, `1.2k`. Reject nothing a person would type. Format canonically when they leave the field.
- **Never reformat mid-typing.** Inserting a thousands separator mid-typing moves the caret. It's the most infuriating input bug in fintech. Format on blur only.
- **Caret preservation** if you must transform during input — measure the caret offset from the *right*, not the left.
- **Never block paste.**
- **Locale-aware decimal separator.** A German user types `1234,56`. Accept it.
- **Currency-aware precision.** JPY rejects decimals entirely; KWD accepts three.
- **Max is soft by default.** Show "Exceeds available balance of $4,120.00" as an inline error, but let them type it. An overdraft may be legitimate, and blocking input to prevent an invalid state blocks valid ones too. The check — and the Max button — apply only when `max` is in the field's own currency; a balance in another currency is shown but never compared.
- **Big.** `figure-lg` (28/32) or larger. It's the most important number on the screen and should look it.
- **The symbol is part of the field**, at `--text-tertiary`, not a floating adornment that misaligns as the value grows.

### Accessibility
`aria-label="Amount in US dollars"` · parsed value announced on blur (`"one thousand two hundred thirty-four dollars and fifty-six cents"`) via `aria-describedby` · errors specific and actionable · `aria-invalid` on error.

### Motion
None on the value. Error message: 140ms opacity + 4px translate. Shake on invalid submit is **forbidden**. It signals stress to a user who's already anxious about money.

## Rules this component obeys

Money is minor units, never floats. `null` is not `0` and neither is redacted. Negatives render in accounting parentheses with the parenthesis column reserved on both sides. Debit and credit are two columns. Per-currency decimal places. Polarity is explicit — up is not always good. Every figure states its period, entity, currency, basis and as-of.
