+ Start a Discussion
Vance Kessler 23Vance Kessler 23 

Why the change to lightning:tab to strip out class?

WInter 19 had the following change:
The label attribute now supports text only. Previously the label supported a component type, and you could include, for example, an icon in the tab’s label. If you use a component in a lighting:tab label now, only the text portion of the label value displays. Any CSS classes that are applied are ignored.

The result is that I can no longer add classes to the tab. The following code no longer adds completed to the class attribute:
<lightning:tab id="Calendar" label="Calendar" class="{!v.CalendarHasSaved ? 'completed' : ''}">
Even if I have class="completed" it strips it out.

Why did they need to do this? I had styling that indicated whether a tab was 'complete' which no longer works.
Nilakshi AsthanaNilakshi Asthana

Did you find a solution to this? We are facing the same issue.
Vance Kessler 23Vance Kessler 23
Sorry, no. All my workarounds failed. It is difficult because this is an embedded child control.

Why Salesforce, why?
Vance Kessler 23Vance Kessler 23
Apparently Salesforce thinks it is a bad idea to update the label as well. This doesn't work either:
    <lightning:tab id="Calendar" label="{!v.CalendarHasSaved ? 'Calendar&#x2714;' : 'Calendar'}">
The label never changes. I tried simple text '-YES' and that doesn't work either.