How to change label of lightning input field?
First have a look on attributes of the lightning-input-field component:- We are interested in attribute named variant which says the variant changes the label position of an input field. Accepted variants include standard, label-hidden, label-inline, and label-stacked.
Why is the asterisk not visible in Lightning?
When using lightning:input component with variant=label-hidden as required, asterisk is not visible in UI. This is seen in summer ’18 release. This issue is seen because the class=”slds-assistive-text” hides the entire label. This issue is also seen for inline edit for required fields.
Why does SLDs-assistive text hide the label?
This is seen in summer ’18 release. This issue is seen because the class=”slds-assistive-text” hides the entire label. This issue is also seen for inline edit for required fields. Repro 1. Create lightning component using lightning:input as follows :
Is there a Toggle with label above in Lightning?
Unfortunately, SLDS doesn’t have a “toggle with label above” out of the box, so lightning:input doesn’t really have a feature like this, either. However, you can simulate it with a few SLDS bits: Otherwise, you might want to stick with writing your own custom toggle component using slds, instead, but customize it to use a stacked label.
What’s the best way to override Lightning input?
Atul, great solution, it’s self-explanatory for me and plus you did explain the approach is to “override”. I would just add a couple of adjustments: label height: 45, label width: 240, this then tighten up the extra spacing (which doesn’t fire the click/mouseover) around the lightning input control.
Why did I remove top 0 from lightning?
Also, had to remove top:0 from the lightning input because it was leaving some space on top which again doesn’t fire the click/mouseover on the input. I prefer this approach over the CSS one because I dynamically change the text displayed to the user by passing the value from the controller.
How to get the name of a field in Lightning?
You should use onload event to fetch the record details. Also you cannot get the label and field API name directly – you need to get them separately. You can use the same attribute that you set in UI – fieldName and outerText for output value, but yes, probably getting value with load event handler is better
How to get the label and value of a field?
I want to do processing on these fields so I want field label and field values. You should use onload event to fetch the record details. Also you cannot get the label and field API name directly – you need to get them separately.