Tuesday, December 20, 2022

LWC Compare Base Components

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.


Note The components support the objects that User Interface API supports. External objects and person accounts aren’t supported. See Supported Objects.
Feature lightning-record-form lightning-record-view-form lightning-record-edit-form
Create Records Yes   Yes
Edit Records Yes   Yes
View Records Yes Yes  
Read-Only Mode Yes Yes  
Layout Types Yes    
Multi Column Layout Yes Yes Yes
Custom Layout for Fields   Yes Yes
Custom Rendering of Record Data   Yes Yes

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.

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.

Note 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.

No comments:

Post a Comment

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC)

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC) Introduction: Salesforce Lightning Web ...