UIR

AmountInput

A money amount with its own keypad. Digits rise in and drop out, the rest slide to make room, commas move as the number grows, and it shrinks to keep fitting.

Preview

Installation

npx @codewithrabby/ui@latest add amount-input

Usage

import { AmountInput } from "@/components/uir/amount-input";

<View style={{ flex: 1 }}>
  <AmountInput
    currency="₦"
    maxDigits={9}
    onChange={(value) => setAmount(value)}
    deleteIcon={<Delete color="white" size={24} />}
  />
</View>

Props

PropTypeDefault
currency

Symbol shown before the amount.

string"$"
maxDigits

Most digits that can be typed.

number9
onChange

Called on every key press that changes the amount.

(value: number, digits: string) => void—
fontSize

Digit size at full scale.

number64
minScale

Smallest the amount shrinks to (0–1).

number0.55
textColor

Amount and key colour.

string"#fff"
keyPressedColor

Key background while pressed.

string"#1c1c1e"
deleteIcon

Content of the delete key.

ReactNode⌫
style

Style for the outer container.

ViewStyle—