Tree
Angular Material Tree displays hierarchical data, useful for visualizing nested structures like file systems or grouped content. BuilderKit restyles the nodes, toggles and spacing so the mat-tree component matches the rest of the design system.
A node is plain markup, so anything can sit next to the label, for example an icon button or a checkbox for multi selection.
Example
A nested tree whose parent nodes expand and collapse with matTreeNodeToggle.
Fruit
Vegetables
Green
Orange
<mat-tree [dataSource]="dataSource" [childrenAccessor]="childrenAccessor" #tree>
<mat-nested-tree-node *matTreeNodeDef="let node">{{ node.name }}</mat-nested-tree-node>
<mat-nested-tree-node *matTreeNodeDef="let node; when: hasChild" matTreeNodeToggle>
<div class="mat-tree-node">
<button matIconButton matTreeNodeToggle>
<mat-icon [svgIcon]="tree.isExpanded(node) ? 'chevron-down' : 'chevron-right'" />
</button>
<div>{{ node.name }}</div>
</div>
<div [class.hidden]="!tree.isExpanded(node)">
<ng-container matTreeNodeOutlet></ng-container>
</div>
</mat-nested-tree-node>
</mat-tree>