1

Here's a general question about the Lightning form tags lightning-record-view-form and lightning-record-edit-form. Why don't they look like Lighting Detail pages?

Lightning Detail page have labels to the left of fields an horizontal lines between fields.

The LWC lightning-record-view-form and lightning-record-edit-form tags puts labels above fields and no horizontal rules between fields.

Detail page and LWC record view form examples below....

enter image description hereenter image description here

1 Answer 1

0

You need to use variant of input field while working with record forms.

The variant changes the label position of an input field. Accepted variants include standard, label-hidden, label-inline, and label-stacked.

The variant, if specified, determines the label position. Otherwise, the density setting of the parent form determines the label position.

<lightning-input-field
                field-name="ContactId"
                variant="label-inline"
            ></lightning-input-field>

Read more here:- https://developer.salesforce.com/docs/component-library/bundle/lightning-input-field/documentation

1
  • I see that -- variant="label-inline" -- will move the label on the field. I haven't found that it changes the overall appears do that of the Detail page layout with the lines between the fields (see image).
    – Ken
    Commented Oct 19, 2023 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .