Newer Version Available
force:inputField
An abstract component that provides a concrete type-specific input component implementation based on the data to which it is bound.
Represents an input field that corresponds to a field on a Salesforce object. This component respects the attributes of the associated field. For example, if the component is a number field with 2 decimal places, then the default input value contains the same number of decimal places. Bind the field using the value attribute and provide a default value to initialize the object.
1<aura:attribute name="contact" type="Contact"
2 default="{ 'sobjectType': 'Contact' }"/>
3<force:inputField aura:id="contactName"
4 value="{!v.contact.Name}"/>Use a different input component such as ui:inputText if you're working with user input that does not correspond to a field on a Salesforce object.
Attributes
| Attribute Name | Attribute Type | Description | Required? |
|---|---|---|---|
| body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
| class | String | The CSS style used to display the field. | |
| errorComponent | Component[] | A component which is responsible for displaying the error message. | |
| required | Boolean | Specifies whether this field is required or not. | |
| value | Object | Data value of Salesforce field to which to bind. |