It seems that as of this writing, specifying hideDefaultActions: true in column definitions for lightning-tree-grid does not work. I am trying to find some workaround. It seems that, while hacky, CSS may be a path forward. However a selector for lightning-primitive-header-actions, or any variation thereof, does not seem to be applied to the relevant DOM elements.


<lwc-tree-grid ...attributes>


lightning-primitive-header-actions { display: none; }

For now I am just trying to even hide all actions. I have not gotten to the point where I try to hide only the default actions on columns that have both. If CSS will work at all, I should be able to figure out the relevant selectors.

Am I barking up the wrong tree here? Can CSS be used as a workaround? Would it require me to extend the tree grid component somehow?

The only alternative I can think of is to extend lightning-datatable and completely rebuild a custom tree-grid which actually respects the attributes I want. The only other column attribute I care about which is currently not respected is fixedWidth, but I can live with resizeable columns. That approach seems like a much larger effort.

Is there any way to hide the default actions on a tree grid?

1 Answer 1


The Shadow DOM prevents you from using anything other than Styling Hooks. You would necessarily need to write your own component. Fortunately, you can borrow the code directly from lightning-base-components or use the tree from salesforce/base-components-recipes.

  • Except I don't want tree, I want tree-grid, for which they do not share the recipe. Are you saying Styling Hooks do not work unless I write a component which extends tree-grid?
    – Adrian Larson
    Commented Nov 17, 2022 at 17:50
  • @AdrianLarson I guess I got ahead of myself for that part. Still, lightning-base-components should be a path forward. CSS can't target components inside a child component, as the Shadow DOM bit explains. As far as I know, lightning-tree-grid isn't extensible, only lightning-datatable is. I had a link to cross-compiled lightning components in the c namespace, but I can't find it right now.
    – sfdcfox
    Commented Nov 17, 2022 at 18:09
  • I assumed as much with the child DOM. Ugh, sounds like a major headache.
    – Adrian Larson
    Commented Nov 17, 2022 at 18:43

You must log in to answer this question.

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