Skip to main content

Currency Input

Rocket 2.0

The Currency Input component lets the user enter an amount of money, shown with the currency sign and formatted for the locale. The user can also pick the currency when a list of currencies is set.

Properties​

Property
Description
Expected Value
LabelText shown above the field.Text. Default: Amount
Help textHelp text shown under the field.Text
PlaceholderHint text shown when the field is empty.Text. Default: 0.00
Default valueThe amount the field starts with. Changing it resets the field to this amount.Text
Currency (ISO code)The currency of the amount, as an ISO code such as USD, EUR or INR.Text. Default: USD
Currencies to choose from (empty: fixed)Currency codes the user can pick from, such as ['USD', 'EUR', 'GBP']. Leave empty to keep one fixed currency.Array
Number format localeThe locale used to format the number, such as en-US, de-DE or en-IN.Text. Default: en-US
Decimal places (empty: the currency's own)How many decimal places the amount has. Leave empty to use the currency's usual number, such as 2 for USD.Text
Currency signHow the currency is shown next to the amount: Symbol such as CA$, Narrow such as $, or Code such as CAD.Symbol, Narrow, Code. Default: Symbol
Show clear buttonShows a button that clears the amount.On or off. Default: Off
Min valueThe smallest amount allowed. A lower amount shows a validation error.Text
Max valueThe largest amount allowed. A higher amount shows a validation error.Text

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On changeTriggers when the amount or the currency changes.
On enter pressedTriggers when the user presses Enter in the field.
On focusTriggers when the field gets focus.
On blurTriggers when the field loses focus.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set valueSets the amount to Value, and the currency to Currency when it is given.components.currencyinput1.setValue("", "")
Set currencyChanges the currency to Currency and rounds the amount to that currency's decimal places.components.currencyinput1.setCurrency("")
ClearClears the amount.components.currencyinput1.clear()
Set focusMoves keyboard focus to the field.components.currencyinput1.setFocus()
Set blurRemoves keyboard focus from the field.components.currencyinput1.setBlur()
Set visibilityShows the component when true, hides it when false.components.currencyinput1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.currencyinput1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.currencyinput1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelText shown above the field.{{components.currencyinput1.label}}
descriptionHelp text shown under the field.{{components.currencyinput1.description}}
placeholderHint text shown when the field is empty.{{components.currencyinput1.placeholder}}
defaultValueThe amount the field starts with. Changing it resets the field to this amount.{{components.currencyinput1.defaultValue}}
currencyThe currency of the amount, as an ISO code such as USD, EUR or INR.{{components.currencyinput1.currency}}
currencyOptionsCurrency codes the user can pick from, such as ['USD', 'EUR', 'GBP']. Leave empty to keep one fixed currency.{{components.currencyinput1.currencyOptions}}
localeThe locale used to format the number, such as en-US, de-DE or en-IN.{{components.currencyinput1.locale}}
decimalPlacesHow many decimal places the amount has. Leave empty to use the currency's usual number, such as 2 for USD.{{components.currencyinput1.decimalPlaces}}
currencyDisplayHow the currency is shown next to the amount: Symbol such as CA$, Narrow such as $, or Code such as CAD.{{components.currencyinput1.currencyDisplay}}
showClearBtnShows a button that clears the amount.{{components.currencyinput1.showClearBtn}}
minValueThe smallest amount allowed. A lower amount shows a validation error.{{components.currencyinput1.minValue}}
maxValueThe largest amount allowed. A higher amount shows a validation error.{{components.currencyinput1.maxValue}}
valueThe amount as a number, or null when the field is empty.{{components.currencyinput1.value}}
formattedValueThe amount formatted with its currency sign, such as $1,234.50.{{components.currencyinput1.formattedValue}}
isVisibleWhether the component is visible.{{components.currencyinput1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.currencyinput1.isLoading}}
isDisabledWhether the component is disabled.{{components.currencyinput1.isDisabled}}

Styles​

Style
Default
Label colorTheme: Primary text
Help text colorTheme: Placeholder text
Field backgroundTheme: Surface 1
Field text colorTheme: Primary text
Placeholder colorTheme: Placeholder text
Field border colorTheme: Default border
Accent (focus ring, selection)Theme: Brand primary
Error color (message and border)Theme: Error
Field radius—
Currency sign colorTheme: Placeholder text
Currency picker backgroundtransparent
Currency picker text colorTheme: Primary text
Popover backgroundTheme: Surface 1
Popover text colorTheme: Primary text
Popover item hover backgroundTheme: Surface 3
Selected item text color (on the accent)Theme: Surface 1
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.