suiss/ui · Component
Amount Input
A large, locale-formatted money display with an on-screen keypad for entering an amount.
Amount Input is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

AmountInput combines a big formatted amount with a Keypad. The amount is formatted with Intl.NumberFormat for the given locale and currency, the currency symbol is drawn smaller, and the font size steps down as the number gets longer.
The decimal key appears only when the currency allows fractions, using the locale's decimal separator. A key that would exceed the limits is rejected with a shake and an error haptic; accepted keys play a selection haptic.
Installation
The CLI also adds what it builds on: Keypad, Text. On React Native it also adds the animated view components/ui/animated-view.tsx.
Manual
- Install the dependencies:
-
Add the pieces it builds on: Keypad, Text, and the primitives
components/primitives/haptics.tsx, and the animated viewcomponents/ui/animated-view.tsxfrom the next step. -
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the source into
components/ui/amount-input.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: Keypad, Text, and the primitives
components/primitives/haptics.tsx, and the animated viewcomponents/ui/animated-view.tsxfrom the next step. -
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the source into
components/ui/amount-input.tsx:
- Update the import paths to match your project.
- Install the dependencies:
-
Add the pieces it builds on: Keypad, Text, and the primitives
components/primitives/haptics.tsx, and the animated viewcomponents/ui/animated-view.tsxfrom the next step. -
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the source into
components/ui/amount-input.tsx:
- Update the import paths to match your project.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
The value is a plain numeric string such as "1250.5". Use defaultValue for uncontrolled state, or value with onValueChange, which receives the string and the parsed number.
Fraction digits default to the currency's own precision (for example 0 for JPY); override with maxFractionDigits. Use max to cap the amount. Input is limited to 15 digits.
Pass deleteLabel and decimalLabel to localize the keypad's spoken labels.
Examples
Filled
Starts with a value through defaultValue.

Controlled
Controlled with value and onValueChange.

Long amount
A long amount that shrinks to fit.

Euro
EUR in the de-DE locale with a comma decimal separator.

Turkish lira
TRY in the tr-TR locale.

Yen
JPY, which has no decimal key.

With max
Capped at 500 with max; larger entries are rejected.

Disabled
A disabled input with a dimmed amount and keypad.

API Reference
AmountInput
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | Controlled numeric string. |
defaultValue | string | "" | Initial numeric string when uncontrolled. |
onValueChange | (value: string, amount: number) => void | - | Called with the new string and its numeric amount. |
currency | string | - | ISO currency code used for formatting. |
locale | string | - | Locale used for formatting and the decimal separator. |
maxFractionDigits | number | - | Maximum digits after the decimal separator. |
max | number | - | Largest allowed amount. |
placeholder | string | "0" | Shown in place of the integer when empty. Defaults to "0". |
disabled | boolean | false | Dims the amount and disables the keypad. |
deleteLabel | string | - | Accessibility label for the delete key. |
decimalLabel | string | - | Accessibility label for the decimal key. |
amountClassName | string | - | Extra classes for the amount text. |
keypadClassName | string | - | Extra classes for the keypad. |
Also accepts the props of React.ComponentProps<typeof View>.
Accessibility
- The amount text is a polite live region, so changes are announced.
- Its label is the formatted amount, prefixed with
accessibilityLabelwhen given. - Keypad keys announce their digit; the delete key is disabled while the value is empty.
Notes
- The shake animation respects the system Reduce Motion setting.
- Uses tabular numerals so digits do not shift as they change.
- Uses
text-foregroundandtext-muted-foregroundtokens; light and dark follow the system appearance.








