Output Currency (Deprecated)

ui:outputCurrency

Deprecated as of API version 47.0. We recommend migrating to Lightning Web Components and using the lightning-formatted-number component.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App

Deprecation Guidelines 

We recommend using Lightning Web Components whenever possible. When migrating to Lightning Web Components, use lightning-formatted-number with format-style="currency".

For more information, see Aura Components in the ui Namespace Are Deprecated.

Usage Overview (Deprecated) 

A ui:outputCurrency component represents a number as a currency that is wrapped in an HTML span tag. We recommend using lightning:formattedNumber with style="currency" instead of ui:outputCurrency.

This component can be used with ui:inputCurrency, which takes in a number as a currency. To apply Lightning Design System styling, we recommend that you use lightning:input with type="number" and formatter="currency" instead of ui:inputCurrency.

To display a currency, you can use an attribute value and bind it to the ui:outputCurrency component.

1<aura:attribute name="myCurr" type="Decimal" default="50000" />
2
3<ui:outputCurrency aura:id="curr" value="{!v.myCurr}" />

The previous example renders the following HTML.

1<span class="uiOutputCurrency">$50,000.00</span>

To override the browser’s locale, use the currencySymbol attribute.

1<aura:attribute name="myCurr" type="Decimal" default="50" currencySymbol="£" />

You can also override it by specifying the format.

1var curr = cmp.find("curr");
2curr.set("v.format", "£#,###.00");

To display record data for Salesforce objects, use lightning:outputField with lightning:recordViewForm, or use lightning:recordForm. To display record data with a custom layout, use force:recordData.

Note

Attributes 

NameDescriptionTypeDefaultRequired
bodyThe body of the component. In markup, this is everything in the body of the tag.Aura.Component[]
classA CSS style to be attached to the component. This style is added in addition to base styles output by the component.String
currencyCodeThe ISO 4217 currency code specified as a String, e.g. “USD”.String
currencySymbolThe currency symbol specified as a String.String
formatThe format of the number. For example, format=“.00” displays the number followed by two decimal places. If not specified, the default format based on the browser's locale will be used.String
valueThe output value of the currency, which is defined as type Decimal.Decimal