0

I wanted to implement Lightning TreeGrid LWC component with no header row.

Tried Updating the CSS in inspect element

I was able to hide the header by modifying the Thead css as shown in the image from inspect element but not sure which class to use to achieve the same in the LWC CSS file.

Could you guys please help?

1 Answers1

0

The lightning-tree-grid specification doesn't provide the possibility of removing the table header out of the box. Although the component blueprint in Lightning design system demonstrates a headless option.

Because of the use of Shadow DOM in LWC you can't change the properties of child components directly.

You basically have 2 options:

  • use a global style resource and modify CSS as you desire, like described in this answer
  • create your own tree grid component and extend it with whichever functionality you need. For some components, salesforce provides their source code, but tree-grid doesn't appear among them

Happy coding.

David Rubin
  • 196
  • 6