1

I notice that when using a <lightning-tabset>. It renders a hidden <li> which is an overflow button 'slds-tabs_default__overflow-button', with style visibility:hidden.

Can we prevent this <li> from being rendered ?

In the base component of the tabset, there is an api variable named disableOverflow. Tried setting this to true. But the <li> still rendered.

1 Answer 1

-1

Have you tried giving it Style display:none

try this in js file:

renderedCallback(){
    let style = document.createElement("style");
    style.innerText = `lightning-tab-bar li.slds-tabs_default__item.slds-tabs_default__overflow-button{
        display:none;
    }`;
    this.template?.querySelectorAll('lightning-tabset')?.forEach(element => {
        element.appendChild(style)
    });
}
4
  • Yes, I have tried this, the style would not apply to the component. If I do the same in console, it works. .slds-tabs_default__overflow-button { display: none !important; height: var(--slds-c-tabs-item-sizing-height, var(--sds-c-tabs-item-sizing-height, var(--lwc-lineHeightTab,2.5rem))); line-height: var(--slds-c-tabs-item-line-height, var(--sds-c-tabs-item-line-height, var(--lwc-lineHeightTab,2.5rem))); } Commented Oct 2, 2023 at 22:37
  • @Akshay-Sharmax begging for votes/accepts (i.e. "please upvote and mark as best answer") is frowned upon here. It doesn't add any useful information to the answer. If your answer is correct and high enough quality, then it will naturally attract upvotes.
    – Derek F
    Commented Oct 3, 2023 at 15:55
  • I've downvoted this because the information you've provided appears to be wrong. Applying a <style> tag inside of a tag in the body of a document was only possible for a few years, and was never widely supported. In short, your suggestion does not produce valid HTML (though browsers may be able to undo/reinterpret such a mistake so it doesn't break the page completely). Using the classList property (with its add/remove/replace/toggle functions) looks like the way to go about this.
    – Derek F
    Commented Oct 3, 2023 at 16:19
  • @DerekF Actually was new to the platform and also a learner, thanks for helping out.. If you could provide a code snippet how can we use these classList properties in this specific case it would be a great learning Commented Oct 3, 2023 at 19:23

You must log in to answer this question.

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