I'm trying to create a table "With No Borders" using standard lightning-datatable of LWC.

I'm referring to the pieces of codes given in https://www.lightningdesignsystem.com/components/data-tables/#With-no-borders and https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/example.

One thing I have understood that I have to have to see the magic.

I tried accessing thead using this.template.querySelectorAll('thead')[0] and adding class in it as


But I couldn't achieve the desired result. So can anyone please help me regarding it? Let me know what I'm missing, or is it not possible to achieve this at all.

Note: I have defined class="slds-table slds-table_cell-buffer slds-table_header-hidden" at data-table component itself.

1 Answer 1


You can't modify the internal components/state of a component except through their public APIs. As such, it's not possible to do what you're trying to do. You would need to build your own custom datatable implementation.

You must log in to answer this question.

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