AmountInput

A big amount field. Digits group as you type, the figure shakes and turns red past your balance, and chips add to it or fill the max. Finance.

Open playground

About

AmountInput is a React component in the Finance category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { AmountInput } from "@ashutoshswamy/smoui" and set label, max, currency among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { AmountInput } from "@ashutoshswamy/smoui";

<AmountInput label="Amount to send" max={2480} quick={[10, 50, 100]} onChange={setAmount} />

Props 5

label

Accessible name.

string
max

Spendable limit. Past it the figure shakes and reddens; typing is never blocked.

number
currency

ISO currency code.

stringdefault "USD"
quick

Chips that add to the amount.

number[]default [10, 50, 100]
value / defaultValue / onChange

Controlled or uncontrolled value in whole units.

number