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
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/amount-input.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/amount-input.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/amount-input.tsx:
- Update the import paths to match your project setup.
-
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.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 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
Examples
Filled
Use defaultValue to start with a value.
Starts with a value.

Controlled
Pass value and onValueChange to control the amount.

Long amount
The font size steps down as the number gets longer. Input is limited to 15 digits.

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

Turkish lira
TRY in the tr-TR locale.

Yen
Fraction digits default to the currency's own precision, so JPY has no decimal key. Override the precision with maxFractionDigits.

With max
Use max to cap the amount, here at 500. Larger entries are rejected.

Disabled
Disable the input to dim the amount and the keypad.

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.
API Reference
AmountInput
A formatted amount with a keypad for entering it.
| Prop | Type | Default |
|---|---|---|
value | string | - |
defaultValue | string | "" |
onValueChange | (value: string, amount: number) => void | - |
currency | string | - |
locale | string | - |
maxFractionDigits | number | - |
max | number | - |
placeholder | string | "0" |
disabled | boolean | false |
deleteLabel | string | - |
decimalLabel | string | - |
amountClassName | string | - |
keypadClassName | string | - |
Also accepts the props of React.ComponentProps<typeof View>.
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. currency is an ISO currency code, and locale sets the formatting and the decimal separator. placeholder is shown in place of the integer when the value is empty. Pass deleteLabel and decimalLabel to localize the keypad's spoken labels. amountClassName and keypadClassName style the amount text and the keypad. The amount uses tabular numerals so digits do not shift as they change, and the shake animation respects the system Reduce Motion setting.
AmountInput
A formatted amount with a keypad for entering it.
| Parameter | Type | Default |
|---|---|---|
value | Binding<String> | - |
currency | String? | nil |
maxFractionDigits | Int? | nil |
max | Double? | nil |
placeholder | String | "0" |
label | LocalizedStringKey | "Amount" |
deleteLabel | LocalizedStringKey | "Delete" |
decimalLabel | LocalizedStringKey | "Decimal separator" |
onValueChange | ((String, Double) -> Void)? | nil |
AmountInput
A formatted amount with a keypad for entering it.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
value | String? | null |
onValueChange | ((value: String, amount: Double) -> Unit)? | null |
defaultValue | String | "" |
currency | String? | null |
locale | Locale | Locale.getDefault() |
maxFractionDigits | Int? | null |
max | Double? | null |
placeholder | String | "0" |
enabled | Boolean | true |
decimalLabel | String | "Decimal separator" |
deleteLabel | String | "Delete" |








