FleetbaseFleetbase

MoneyInput

<MoneyInput> is a currency-aware money input — formats as the user types using AutoNumeric and shows the currency symbol on the left. Optional currency picker.

<MoneyInput>

A currency-aware money input. Formats as the user types using AutoNumeric and shows the active currency on the left. Optionally lets the user pick a different currency via a built-in dropdown.

Basic Usage

<MoneyInput @value={{this.invoice.total}} @currency="USD" />

The currency symbol ($) is rendered to the left, and the input is auto-formatted (e.g. 1,234.56).

With Currency Picker

<MoneyInput
  @value={{this.amount}}
  @currency={{this.currency}}
  @canSelectCurrency={{true}}
  @onCurrencyChange={{fn (mut this.currency)}}
/>

Arguments

ArgumentTypeDescription
@valuenumber | stringAmount value
@currencystringISO 4217 code (e.g. USD, EUR, MNT)
@canSelectCurrencybooleanShow the currency picker dropdown
@onCurrencyChange(currency)Called when the user picks a different currency
@wrapperClassstringExtra classes on the outer wrapper

Any additional ...attributes are forwarded to the underlying <input>.

Inside an InputGroup

<InputGroup @name="Price">
  <MoneyInput @value={{this.product.price}} @currency={{this.store.currency}} />
</InputGroup>

Format Conventions

The displayed value is formatted with the currency's standard separator and decimal scheme. The bound @value is the raw number — what your model should store. Keep monetary values as integer minor units server-side (cents for USD, etc.) and convert on display if needed.

Source

FileDescription
addon/components/money-input.hbsTemplate
addon/components/money-input.jsClass
addon/components/money-input/CurrencyHandle and related subcomponents
MoneyInput | Fleetbase