Compare Base Components

Compare lightning-record*form components to find the one that meets your use case.

These components provide a form layout. Field labels use values that are based on the default values in your org. The components handle record create, read, and update changes without requiring Apex code. They use Lightning Data Service to cache and share record updates across components.

The components support the objects that User Interface API supports. External objects and person accounts aren’t supported. See Supported Objects.

Featurelightning-record-formlightning-record-view-formlightning-record-edit-form
Create RecordsYes Yes
Edit RecordsYes Yes
View RecordsYesYes 
Read-Only ModeYesYes 
Layout TypesYes  
Multi Column LayoutYesYesYes
Custom Layout for Fields YesYes
Custom Rendering of Record Data YesYes

For most use cases, lightning-record-form provides a great starting point. It combines and simplifies the functionality of lightning-record-view-form and lightning-record-edit-form. All three components support a multi column layout. For example, you can use <div class="slds-grid"> to create a column.

Specify either a layout type or the fields and the mode, and the component takes care of layout, validation, CRUD changes, and error handling. The lightning-record-form component also switches from edit mode to view mode after changes are submitted successfully.

To improve performance, specify fields instead of a layout whenever possible. Specify a layout only when you want the administrator, not the component, to control the fields that are provisioned. The component must handle receiving every field that is assigned to the layout for the context user.

For more advanced use cases that require custom field layouts and custom rendering of record data, use lightning-record-view-form and lightning-record-edit-form.

If you need more customization than the base components allow, such as a custom user interface, see Build Custom UI to Create and Edit Records and Get Record Data.

See Also