SIGN IN SIGN UP

Login to your account

Username or Email *
Password *
Remember Me
LWC Progress | ( Lessons)

Lesson: 21 | Load a Record (View a Record)


To display a record in a Lightning web component (LWC), you can use the lightning-record-form component and pass in a record Id. Here's a simple explanation of how to do it:

If you just need to display the record with default output fields, use the lightning-record-form component with record-id attribute set to the Id of the record you want to display.

If you need a custom layout, use lightning-record-view-form instead of lightning-record-form.

If you need even more customization than the form-based components allow, you can use a wire adapter like getRecord to load the record data and then manually render it in your LWC.

In lightning-record-form, you can display a record in two modes - view and read-only. View mode is the default when record-id is provided. In view mode, the form loads with output fields and inline editing enabled. If a user clicks an edit icon, all fields in the form become editable, and the form displays Submit and Cancel buttons. In read-only mode, the form loads with output fields only and doesn't include edit icons or Submit and Cancel buttons.


Prev You need to login to have access to the quizzes. Next

Mastered by 16 users.

Lightning Web Components

A. Component Reference (27 lessons)
B. Lightning Web Components | Utilities (11 lessons)
C. Lightning Web Component Guide (41 lessons)
D. Java Script Methods for LWC (23 lessons)
E. HTML (18 lessons)
Go to top