Officina UI
Components

CurrencyInput

NumberInput preset for money — shows the locale currency symbol and fixes 2-decimal precision.

CurrencyInput is a NumberInput preset for monetary amounts. Give it a currency (ISO 4217 code like "USD") and it derives the symbol with Intl.NumberFormat, displays it as a prefix, and locks precision to 2 decimals with a 0.01 step. The controlled value is the amount in major units (or null when empty); pass locale to format the symbol for a specific region.

Example

Preview
$
€
import { CurrencyInput } from '@officina/ui';
import { useState } from 'react';

function Example() {
  const [amount, setAmount] = useState<number | null>(19.99);
  return <CurrencyInput value={amount} onChange={setAmount} currency="USD" />;
}

API

PropTypeDefaultDescription
currency*string—ISO 4217 currency code (e.g. "USD").
onChange*(value: number | null) => void—Called with the parsed value (null when cleared).
value*number | null—Current value, or null when empty.
ariaLabelstring—Accessible name when no visible label is present.
disabledboolean—
invalidboolean—Marks the field invalid for validation styling and `aria-invalid`.
localestringen-USBCP 47 locale for formatting. Defaults to the runtime locale.
maxnumber—Maximum allowed value.
minnumber—Minimum allowed value.
namestring—Form field name, for native form submission / form libraries.
placeholderstring—
requiredboolean—
showSteppersboolean—Show the stepper +/- buttons.
sizeenum—Control size.
suffixstring—Unit suffix shown inside the field (e.g. "%").

On this page