Input Number (Deprecated)
ui:inputNumber
Deprecated as of API version 47.0. We recommend migrating to Lightning Web Components and using the lightning-input component.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App
We recommend using Lightning Web Components whenever possible. When migrating to Lightning Web Components, use lightning-input with number type.
For more information, see Aura Components in the ui Namespace Are Deprecated.
A ui:inputNumber component represents a number input field, which is rendered as an HTML input element of type text. It uses JavaScript's Number type MAX_SAFE_INTEGER and MIN_SAFE_INTEGER precision to determine the supported number of digits, which is about 16 digits. Numbers outside of the precision can get truncated or rounded.
To apply Lightning Design System styling, we recommend that you use lightning:input with type="number" instead of ui:inputNumber. To render the output from a ui:inputNumber component, use the ui:outputNumber component. Similarly, we recommend using lightning:formattedNumber instead of ui:outputNumber.
This example shows a number field, which displays a value of 10.
The previous example results in the following HTML.
To render the output from a ui:inputNumber component, use the ui:outputNumber component. When providing a number value with commas, use type="integer". This example returns 100,000.
For type="string", provide the number without commas for the output to be formatted accordingly. This example also returns 100,000.
Specifying format="#,##0,000.00#" returns a formatted number value like 10,000.00.
To create forms for Salesforce objects without using Apex controllers, use lightning:inputField with lightning:recordEditForm, or use lightning:recordForm. To create an input field for different data types, use lightning:input.