Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override padding for mat tree

I am using this example here to build a mat-tree using a flat datasource. Now I want to override the default padding-left which is 40px for all the following children. This is how I am doing it:

mat-tree-node:not(:first-child) {
    padding-left: 16px;
}

This works, but only sets 16px padding on the level 2 of the tree nodes. The rest of the nested children do not accumulate the 16px as I keep on expanding them. Is it possible to override matTreeNodePadding directive?

like image 740
faizanjehangir Avatar asked Aug 21 '19 01:08

faizanjehangir


1 Answers

I was able to use the api documentation here to resolve the issue. Had to pass in the selector input for matTreeNodePadding indentation in this case.

<mat-tree-node matTreeNodePadding matTreeNodePaddingIndent="20">

This would override the existing default 40px left padding to 20px.

like image 130
faizanjehangir Avatar answered Oct 13 '22 01:10

faizanjehangir