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-inputUsage
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
| Prop | Type | Default |
|---|---|---|
currencySymbol shown before the amount. | string | "$" |
maxDigitsMost digits that can be typed. | number | 9 |
onChangeCalled on every key press that changes the amount. | (value: number, digits: string) => void | — |
fontSizeDigit size at full scale. | number | 64 |
minScaleSmallest the amount shrinks to (0–1). | number | 0.55 |
textColorAmount and key colour. | string | "#fff" |
keyPressedColorKey background while pressed. | string | "#1c1c1e" |
deleteIconContent of the delete key. | ReactNode | ⌫ |
styleStyle for the outer container. | ViewStyle | — |