suiss/uim · React Native Component

Amount Input

A large, locale-formatted money display with an on-screen keypad for entering an amount.

Amount Input is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Amount Input on iOS in light mode

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

$ pnpm dlx @esuiss/uim@latest add amount-input

The CLI also adds what it builds on: Keypad, Text.

Manual

  1. Install the dependencies:
npx expo install cn react-native-reanimated react-native-worklets
  1. Add the pieces it builds on: Keypad, Text, and the primitives components/primitives/haptics.tsx.

  2. Copy the source into components/ui/amount-input.tsx:

uniwind/components/ui/amount-input.tsx
import { cn } from "cn"
import * as React from "react"
import { View } from "react-native"
import {
  ReduceMotion,
  useAnimatedStyle,
  useSharedValue,
  withSequence,
  withTiming,
} from "react-native-reanimated"
import { useHaptics } from "@/components/primitives/haptics"
import { AnimatedView } from "@/components/ui/animated-view"
import { Keypad, type KeypadKeyValue } from "@/components/ui/keypad"
import { Text } from "@/components/ui/text"

type AmountPart = { type: string; value: string }
  1. Update the import paths to match your project.

Usage

import { AmountInput } from "@/components/ui/amount-input"
<AmountInput currency="USD" locale="en-US" />

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.

iOS
Amount Input (filled) on iOS in light mode

Controlled

Controlled with value and onValueChange.

iOS
Amount Input (controlled) on iOS in light mode

Long amount

A long amount that shrinks to fit.

iOS
Amount Input (long amount) on iOS in light mode

Euro

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

iOS
Amount Input (euro) on iOS in light mode

Turkish lira

TRY in the tr-TR locale.

iOS
Amount Input (turkish lira) on iOS in light mode

Yen

JPY, which has no decimal key.

iOS
Amount Input (yen) on iOS in light mode

With max

Capped at 500 with max; larger entries are rejected.

iOS
Amount Input (with max) on iOS in light mode

Disabled

A disabled input with a dimmed amount and keypad.

iOS
Amount Input (disabled) on iOS in light mode

API Reference

AmountInput

ExtendsReact.ComponentProps<typeof View>
PropType
About
Controlled numeric string.
Type
string
Default
—
About
Initial numeric string when uncontrolled.
Type
string
Default
""
About
Called with the new string and its numeric amount.
Type
(value: string, amount: number) => void
Default
—
About
ISO currency code used for formatting.
Type
string
Default
—
About
Locale used for formatting and the decimal separator.
Type
string
Default
—
About
Maximum digits after the decimal separator.
Type
number
Default
—
About
Largest allowed amount.
Type
number
Default
—
About
Shown in place of the integer when empty. Defaults to "0".
Type
string
Default
"0"
About
Dims the amount and disables the keypad.
Type
boolean
Default
false
About
Accessibility label for the delete key.
Type
string
Default
—
About
Accessibility label for the decimal key.
Type
string
Default
—
About
Extra classes for the amount text.
Type
string
Default
—
About
Extra classes for the keypad.
Type
string
Default
—

Accessibility

  • The amount text is a polite live region, so changes are announced.
  • Its label is the formatted amount, prefixed with accessibilityLabel when 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-label and text-label-tertiary tokens; light and dark follow the system appearance.