Lightning Record Edit form Example

Use the lightning-record-edit-form component to create a form that’s used to add a Salesforce record or update fields in an existing record on an object. The component displays fields with their labels and the current values, and enables you to edit their values.

lightning-record-edit-form supports the following features.

  • Editing a record’s specified fields, given the record ID.
  • Creating a record using specified fields.
  • Customizing the form layout
  • Custom rendering of record data

If you don’t require customizations, use lightning-record-form instead.

To specify editable fields, use lightning-input-field components inside lightning-record-edit-form component. See the Editing a Record section.

To display record fields as read-only in lightning-record-edit-form, use lightning-output-field components to specify those fields. You can also use HTML and other display components such as lightning-formatted-name to display non-editable content.

To display all fields as read-only, use the lightning-record-form component with mode="readonly" or the lightning-record-view-form component instead of lightning-record-edit-form.


Lightning Record Edit form Example
Scroll to Top