Represents a read-only display of a value for a field on a Salesforce object. This component respects the attributes of the associated field and how it should be displayed. For example, if the component contains a date and time value, then the default output value contains the date and time in the user's locale. Bind the field using the value attribute and provide a default value to initialize the object.
<aura:attribute name="contact" type="Contact" default="{ 'sobjectType': 'Contact'}"/> <force:outputField aura:id="contactName" value="{!v.contact.Name}"/>
To load record data, wire up the container component to an Apex controller that returns the data. See Working with Salesforce Records in the Lightning Components Developer Guide for more information.
This component doesn't inherit the Lightning Design System styling. Use lightning:input if you want an input field that inherits the Lightning Design System styling.
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 | A CSS style to be attached to the component. This style is added in addition to base styles output by the component. | |
value | Object | Data value of Salesforce field to which to bind. |