Skip to content

CurrencyInput

Anatomy

+----------------------+
| $ 1,234.56 USD |
+----------------------+

When to use

  • Any price / cost / amount input in checkout, invoicing, pricing forms.
  • Inputs that need to display currency-aware formatting (commas vs periods, symbol position).

Examples

Basic

<CurrencyInput defaultValue={1234.5} />

Localized

<CurrencyInput currency="EUR" locale="de-DE" defaultValue={1234.5} />
// → "1.234,50 € EUR"

Allowing negatives (refunds / adjustments)

<CurrencyInput
currency="USD"
positiveOnly={false}
defaultValue={-25}
/>

Inside a react-hook-form

const { setValue, watch } = useFormContext<{ price: number }>();
<CurrencyInput
value={watch('price')}
onValueChange={(v) => setValue('price', v ?? 0)}
currency="USD"
/>

Tokens

See the tokens block in this spec’s frontmatter.

Install: @helixui/core

import { CurrencyInput } from '@helixui/core'

status: stable · since: 0.1.0

Tags: currency, money, money-input, locale, intl, payment, pricing

Props

NameTypeDefaultDescription
valuenumber | nullundefinedControlled numeric value.
defaultValuenumber | nullundefinedUncontrolled initial value.
onValueChange(value: number | null) => voidundefinedFires with the parsed numeric value or null when the field is empty.
currencystringUSDISO 4217 currency code. Drives the symbol and the default precision.
localestringnavigator.languageOverride the user’s locale. Affects symbol position and decimal separator.
showSymbolbooleantrueRender the currency symbol inside the input.
precisionnumberundefinedOverride the number of decimal places. Defaults to what the currency expects.
positiveOnlybooleantrueReject negative values.
size'sm' | 'md' | 'lg'mdInput size.
tone'brand' | 'neutral' | 'danger'brandTone for focus ring.

Tokens used

color.bg.input, color.bg.surface.default, color.bg.action.brand.subtle, color.border.subtle, color.border.action.brand, color.border.danger, color.text.primary, color.text.muted, radius.md, spacing.1, spacing.2, spacing.3, spacing.4, font.size.xs, font.size.sm, font.size.md, font.size.lg

Accessibility

Role: textbox

Keyboard

KeyAction
0-9Enter digits.
.Decimal separator (or , depending on locale).

Notes

  • Uses inputmode='decimal' so mobile keyboards show the numeric layout.
  • On blur the value reformats with thousands separators.
  • Without an explicit aria-label, defaults to e.g. “USD amount”.