Compare Base Components
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.
lightning-record-edit-form—Displays an editable form.
lightning-record-view-form—Displays a read-only form.
lightning-record-form—Supports edit, view, and read-only modes.
The components support the objects that User Interface API supports. External objects and person accounts aren’t supported. See Supported Objects.
|Multi Column Layout|
|Custom Layout for Fields|
|Custom Rendering of Record Data|
For most use cases,
lightning-record-form provides a great starting point. It combines and simplifies the functionality of
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