Output Field

lightning:outputField

Represents a read-only display of a label, help text, and value for a field on a Salesforce object. This component requires API version 41.0 and later.

For Aura components only. For LWC development, use lightning-output-field.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App

Use the lightning:outputField component in lightning:recordViewForm to display the label and current value of a record field on a Salesforce object. Use the fieldName attribute on lightning:outputField to specify the API field name.

For standard and custom objects, find the field names in Lightning Experience from Setup > Object Manager > (object-name) > Fields & Relationships. Standard object fields are documented in Standard Objects. See Supported Objects in the lightning:recordViewForm documentation for usage considerations about objects.

You must provide the record ID and object API name in the wrapper lightning:recordViewForm component.

The lightning:outputField component displays a read-only field based on the data type for the field you specify. For example, fieldName="CreatedDate" on the Case object references a date/time value, so the component renders an output field that displays the date and time in the user's locale. On the Account object, fieldName="Type" references a picklist. The component renders an output text field labeled Type and displays the current value selected from the account types defined in the org. If fieldName references an email address, phone number, lookup, or URL, then a clickable link is displayed.

In orgs that support multiple languages, lightning:outputField automatically shows the translated labels and picklist values.

This component implements styling from input (readonly state) in the Lightning Design System.

To create a record detail layout, wrap the fields with lightning:recordViewForm and provide the record ID. You don't need additional Apex controllers or Lightning Data Service as data refresh happens automatically.

If you reference an invalid field, no output label or value is rendered.

The user's locale settings determine the display formats for numbers, percentages, and date and time. Locales are currently not supported for currency. Besides field values, lightning:outputField displays the localized labels and help text for the fields based on their metadata, which are defined by your Salesforce admin. Additionally, no output label or value is rendered if you reference an invalid field.

The user's locale settings determine the display formats for numbers, percentages, and date and time.

For currency fields, the currency locale for the org determines the display format.

Besides field values, lightning:outputField displays the localized labels and help text for the fields based on their metadata, which are defined by your Salesforce admin.

Date and time field values are retrieved from the platform along with the user's Salesforce locale setting and passed to lightning:outputField. The component doesn't alter the retrieved date and time values. It displays the date and time in the user's local timezone according to the user's locale and timezone settings. For example, a user who sets the org's timezone as GMT+08:00 with a Japanese locale modifies a record. Let's say the Last Modified By field displays 2025/07/04 4:12 AM. For another user whose org's timezone is GMT-07:00 with an English (United States) locale, the same field displays as 7/3/2025 1:12 PM. The same server-recorded date and time can appear differently to users with different locale and timezone settings.

In Lightning Experience, the locale corresponds to the Locale field on the Language & Time Zone page in the user's profile settings in Salesforce. For example, if fieldName references a date and time value, then the default output value contains the date and time in the user's locale. The locale is determined by the Salesforce locale settings of the user who creates or updates the record, not the user who's viewing the record.

In LWR sites, the site configuration determines the field's language and locale, and the site visitor browser's timezone determines the field's timezone.

lightning:outputField inherits the display density from the enclosing parent form. To override the display density of the parent form, use the variant attribute. When the parent form uses the compact density, you can reduce the whitespace between the label and field using the slds-form-element_1-col class on lightning:outputField. For more information, see lightning:recordEditForm.

lightning:outputField supports fields on objects that are UI API compliant. For supported objects, see the User Interface API Developer Guide.

Fields that have a spanning relationship aren't supported by lightning:outputField. The fields specified must be associated with only one object. A field such as Contact.Account.Ownership is a cross-object reference between the Contact object and the Account object, and can't be displayed in the form.

The supported field data types are:

  • Address: Displays the formatted address without a link to Google Maps.
  • Auto Number: Displays a string that represents the unique number of the record.
  • Checkbox: Displays a disabled checkbox that's either selected or not.
  • Currency: Displays the formatted currency based on the user's locale.
  • Date: Displays the formatted date based on the user's locale.
  • Date/Time: Displays the formatted date and time based on the user's locale.
  • Email: Displays the email address with the mailto: URL scheme.
  • Encrypted String: Displays masking characters to represent an encrypted string such as a password.
  • Formula: Displays the result of the formula in a format based on the result's data type.
  • Geolocation: Displays latitude and longitude in decimal degrees format: 90.0000, 180.0000.
  • Lookup: Displays a relationship between two records, for example, the account ID associated with a contact record. Lookup fields show the current value of the field as a link to the record that it refers to. If the link address can't be computed for any reason, a plain text value is displayed. The mouseover behavior that displays a hover panel of record details is not supported. Lookups are not supported for the OwnerId, CreatedBy, and LastModifiedBy fields. Dependent lookups and external lookups are also not supported. On user lookup fields, the lookup value is displayed without a user icon.
  • Name: Displays the formatted name.
  • Number: Displays the integer or double.
  • Percent: Displays the percentage number.
  • Phone: Displays the phone number with the tel: URL scheme.
  • Picklist and multi-select picklist: Displays picklist values separated by a semi-colon.
  • Text: Displays text up to 255 characters.
  • Text (Encrypted): Displays the encrypted text.
  • Text Area: Displays multi-line text up to 255 characters.
  • Text Area (Long): Displays multi-line text up to 131,072 characters.
  • Text Area (Rich): Displays rich text such as bold or underline text, lists, and images. Unsupported tags and attributes are removed and only their text content is displayed. For more information on supported tags, see Rich Text Editor in Salesforce Help.
  • Time: Displays the formatted time based on the user's locale.
  • URL: Displays a link that opens in the same browser window when it's clicked.

For more information, see the lightning:recordViewForm documentation.

When using lightning:outputField, the field label for certain fields can differ from those displayed on a standard record page. For example, the Name field on the opportunity object displays "Name" instead of "Opportunity Name" while the Name field on the account object displays "Account Name".