Record View
force:recordView
Generates a view of the specified Salesforce record.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App
This component has been superseded by lightning:recordViewForm. Alternatively, use lightning:recordForm if you want to switch between view and edit modes easily.
A force:recordView component represents a read-only view of a record. By default, the record view uses the full layout to display all fields of the record. The type attribute does not support any other value so you don’t need to specify it. Previous versions of this document incorrectly stated that force:recordView could display the compact layout.
If you want granular control over displaying of specific fields, we recommend using lightning:recordViewForm with lightning:outputField instead.
This example shows a record view with a full layout.
1<force:recordView recordId="a02D0000006V8Ov" />You can provide a dynamic ID for the recordId attribute using the format {!v.myObject.recordId}. To load record data, wire up the container component to an Apex controller that returns the data. See Working with Salesforce Data in the Lightning Aura Components Developer Guide for more information.
This component doesn’t fully use the Lightning Design System styling. The layout elements use Lightning Design System styling, but the input fields do not. Use lightning:recordViewForm if you want a component that inherits the Lightning Design System styling.
Attributes
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| body | The body of the component. In markup, this is everything in the body of the tag. | Aura.Component[] | ||
| record | The record (SObject) to load, optional if recordId attribute is specified. | SObject | ||
| recordId | The Id of the record to load, optional if record attribute is specified. | String | ||
| type | The type of layout to use to display the record. The default is FULL, and is the only valid type. | String | FULL |