<nx-sidebar
    resizeHandleAriaLabel="Toggle sidebar width"
    resizeable
    minWidth="140"
>
    <nx-tree [dataSource]="_dataSource" [treeControl]="_treeControl">
        <nx-tree-node *nxTreeNodeDef="let node">
            <a
                nxAction
                nxTreeNodePadding
                nxTreeNodeActionItem
                nxTreeNodePaddingOffset="40"
                routerLink="./"
                [queryParams]="node.query"
                routerLinkActive="is-selected"
                title="{{node.label}}"
            >
                @if (node.icon) {
                <nx-icon nxActionIcon [name]="node.icon"></nx-icon>
                } {{node.label}}
            </a>
        </nx-tree-node>
        <nx-tree-node *nxTreeNodeDef="let node; when: _hasChild">
            <button
                nxAction
                nxTreeNodeToggle
                nxTreeNodeActionItem
                nxTreeNodePadding
                nxTreeNodePaddingOffset="40"
                expandable
                [expanded]="_treeControl.isExpanded(node)"
                title="{{node.label}}"
                type="button"
            >
                @if (node.icon) {
                <nx-icon nxActionIcon [name]="node.icon"></nx-icon>
                } {{node.label}}
            </button>
        </nx-tree-node>
    </nx-tree>
</nx-sidebar>
