Pro unlocks unlimited templates48:00:00Get Pro →

Currency Input

Type an amount; store a number. Thousand separators update while you type. Pass any ISO currency + locale — Intl supplies the symbol and separators. The amount stays LTR for caret stability; the addon follows start/end.

Gallery

Price card with a live numeric readout. value / onValueChange stay numbers.

Loading…

Installation

CLI
npx @sonojs/ui@latest add currency-input
Also needs
npx @sonojs/ui@latest add input-group

Usage

currency-input.tsx
import { CurrencyInput } from "@/components/currency-input"

export function Example() {
  return (
    <CurrencyInput
      currency="USD"
      locale="en-US"
      defaultValue={49}
      placeholder="0.00"
    />
  )
}

Props

PropTypeDefaultDescription
valuenumber · null-Controlled numeric amount.
defaultValuenumber · nullnullInitial amount when uncontrolled.
onValueChange(value: number · null) => void-Fires with the parsed number (or `null` when empty).
currencystring"USD"ISO 4217 code passed to `Intl.NumberFormat`.
localestring"en-US"BCP 47 locale for separators and symbol side.
currencyDisplay"symbol" · "narrowSymbol" · "code" · "name""symbol"How the addon label is rendered.
minimumFractionDigitsnumberfrom currencyBlur formatting floor for fraction digits.
maximumFractionDigitsnumberfrom currencyTyping and blur fraction digit cap.
minnumber-Lower clamp on commit.
maxnumber-Upper clamp on commit.
showCurrencyAddonbooleantrueShow the currency symbol/code addon.
disabledbooleanfalseDisables the field.
classNamestring-Merged onto the `InputGroup` root.

Related

  • Input Group, addon chrome used for the currency label
  • Input, plain text field without money formatting
  • Field, label and describe the control