What is the difference between lightning-record-form, lightning-record-edit-form and lightning-record-view-form?
Answer
All use Lightning Data Service, so no Apex is needed and FLS/sharing are respected.
- lightning-record-form – quickest option; auto-generates a full form (view, edit or read-only) from fields or layout. Least customizable.
- lightning-record-edit-form – you control the layout with
lightning-input-fieldand can add custom buttons, validation and handleonsubmit,onsuccess,onerror. - lightning-record-view-form – read-only display using
lightning-output-field.
Choose record-form for simple CRUD, edit-form for custom layouts, view-form for read-only pages.
lwcldsforms