Amount input
A number of money. The currency is not decoration: it decides which mark is drawn, which side of the number it sits on, and how many decimals the field will accept.
Reach for it
Money, where the currency decides the mark, its side and the decimals.
Not for
A plain quantity. A number with no currency is a Number input.
The locale writes the currency, not the caller
en-US leads with the mark and fr-FR trails it, for the same amount in the same currency. A field with a hardcoded leading symbol is wrong in half the languages the product ships in. The yen field takes no decimals, because the yen has none, and a field fixed at two accepts an amount that does not exist.
The locale trails the mark
The same locale rule, the other way round
Committed value: 1234.5
No decimals, because the currency has none
Where the user picks the currency
There is no currency picker in the component. Which currencies a product offers is product data rather than a design decision, so a screen where the user chooses puts a Select beside the field with the tenant's own list in it.
API reference
AmountInput
| Prop | Type | Default | Description |
|---|---|---|---|
| locale* | string | - | Required, not defaulted. A number's separators are text the user reads, and a default of 'en-US' prints a French invoice total as 1,234.5. Guessing wrong here is worse than asking. |
| currency* | string | - | ISO 4217, e.g. "EUR". Not a symbol: the locale decides how to write it. |
| value | number | null | - | |
| defaultValue | number | null | - | |
| onValueChange | (value: number | null) => void | - | |
| maxFractionDigits | number | - | |
| isNegativeAllowed | boolean | - |
Also takes the standard attributes of a input, minus className, style, size, type, value, defaultValue, onChange and inputMode, minus hasStartAdornment and hasEndAdornment.