Output Number (Deprecated)

ui:outputNumber

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.

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

Usage Overview (Deprecated) 

A ui:outputNumber component represents a number output that is rendered as an HTML span tag. We recommend using lightning:formattedNumber instead of ui:outputNumber.

ui:outputNumber can be used with ui:inputNumber, which takes in a number input. To apply Lightning Design System styling, we recommend that you use lightning:input with type="number" instead of ui:inputNumber.

ui:outputNumber retrieves the locale information and displays the number in the given decimal format. To display a number, you can use an attribute value and bind it to the ui:outputNumber component.

1<aura:attribute name="myNum" type="Decimal" default="10.10" />
2
3<ui:outputNumber value="{!v.myNum}" format=".00" />

The previous example renders the following HTML.

1<span class="uiOutputNumber">10.10</span>

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
formatThe format of the number. For example, format=“.00” displays the number followed by two decimal places. If not specified, the Locale default format will be used.String
valueThe number displayed when this component is rendered.Decimal