TransWikia.com

variant='label-hidden' Not Working for lightning-input-field When field is a Lookup

Salesforce Asked on December 6, 2021

I have a Lightning Web Component and in that I’m using a lighting-record-edit-form. I’m trying to use a custom label for an input by hiding the default one for the lightning-input-field and adding my own. I’m using the variant=’label-hidden’ and it isn’t working.

It works on other fields, just not when the field rendered is a lookup field or a Rich Text field.

I’ve tried some different things with CSS but it doesn’t seem to be picking it up.

I’ve seen some other similar questions with work arounds but they appear to only be for Aura components.

Anybody else encountered this or come up with a workaround?

<lighting-input-field field-name='Lookup_Field__c' variant='label-hidden'></lightning-input-field>

2 Answers

try this

<div class="slds-form-element">
         <label class="slds-form-element__label" >{labelSubject}</label>
         <lightning-input-field variant='label-hidden' field-name={nameField}  required></lightning-input-field>
</div>

Take a look at the variants of this component to change the label's position

Answered by Emmanuel Hernandez Moran on December 6, 2021

I see its working now by using variant="label-hidden"

<lightning-input-field field-name="AccountId" variant="label-hidden"></lightning-input-field>

enter image description here

Answered by arpit gupta on December 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP