CurrencyInput

A numeric input that formats and stores a currency amount.

Installation

pnpm dlx shadcn@latest add @chelone/currency-input

A numeric input that formats and stores a currency amount.

Props

PropTypeDefaultDescription
alwaysOnboolean—As a `<FilterForm>`/`<FilterButton>` filter: always shown, never in the add-filter menu. Read off the element by the filter layer, never by the input.
currenciesreadonly string[]—Provide to enable currency selection; stores composite { amount, currency }.
currencystring—ISO-4217 currency code when storage is a plain number.
defaultValueunknown—Input-level default, ra precedence (seeds only into an untouched hole).
disabledboolean—Native disabled state.
displayLocalestring—Override the user's app locale for formatting symbol/step.
format(value: unknown) => unknown—Read transform (raw form value → input value).
helperTextReactNode—Helper text rendered below the input; a string is translated.
idstring—Explicit element id; a generated `useId` value is used otherwise.
isRequiredboolean—Forces the required marker; ORed with `required()` detection on `validate`.
labelReactNode—The input label. A string is translated; a ReactNode renders as-is; `false` (or `""`) renders no label.
namestring—Legacy field-name alias (ra parity); the wiring uses `source`.
onBlur(event: unknown) => void—Chained AFTER the blur is recorded.
onChange(eventOrValue: unknown) => void—Chained AFTER the parsed value is written to the form.
parse(value: unknown) => unknown—Write transform (input value → stored value).
readOnlyboolean—Native read-only state.
resourcestring—Override the ambient resource (used to resolve the default label key).
sourcestring—The field path RELATIVE to the ambient source scope.
storeAsMinorUnitsboolean—Multiply displayed major units by 100 on write so storage is integer cents.
typestring—The DOM input `type` (text inputs default to `"text"`).
validateValidator | readonly Validator[]—ra-contract validators — composed, first error wins.