Using the Lightning output field component

The Lightning output field component allows us to display the record view using the provided fields. You will need to enclose Lightning:outputfield in a wrapper component: Lightning:recordViewForm. The mandatory attributes for the recordViewForm are the recordId and the objectAPIName.

The syntax for the record view form is as follows:

<aura:component implements="force:hasRecordId,flexipage:availableForRecordHome"> <Lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Contact"> <div class="slds-grid"> <div class="slds-col slds-size_1-of-2"> <!-- Your Lightning:outputField components here --> </div> <div class="slds-col slds-size_1-of-2"> <!-- More Lightning:outputField components here ...

Get Learning Salesforce Lightning Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.