Output Field

force:outputField

Provides a concrete type-specific output component implementation based on the data to which it is bound.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App

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.

force:outputField has been superseded by lightning:outputField. To display record data without using Apex controllers, use lightning:outputField with lightning:recordViewForm, or use lightning:recordForm. To create a generic output field, use a component like lightning:formattedText or lightning:formattedName and so on. For example, use lightning:formattedEmail to display an email address with the mailto: protocol. Alternatively, use lightning:formattedRichText to display rich text, which includes linking for URLs and email addresses.

This example displays data for a contact name. Bind the field using the value attribute and provide a default value to initialize the object.

To load record data, wire up the container component to an Apex controller that returns the contact.

Pass the contact data to the component via a client-side controller.

force:outputField doesn't use the Lightning Design System styling. If you're using force:outputField in a standalone app, this component doesn't support Lightning Design System styling from force:slds.