Tree

Render hierarchical data with expand/collapse controls, selection, and i18n support. ngb-tree keeps ARIA attributes and keyboard navigation baked in.

What is Tree?

ngb-tree consumes an array of NgbTreeNode objects and renders nested lists with keyboard focus, ARIA roles, and optional checkboxes.

Data binding & selection

Bind nodes and let the component handle expand/collapse + selection state.

Selected: None
<ngb-tree
            [nodes]="nodes"
            [showCheckbox]="true"
            (selectionChange)="onSelection($event)"
            (expand)="log('expand ' + $event.label)">
          </ngb-tree>

JSON view

Use type="json" to show key/value nodes for configuration trees.

<ngb-tree [nodes]="settings" type="json"></ngb-tree>

Localization

Provide [i18n] text and the tree adapts to RTL layouts.

<ngb-tree [nodes]="nodes" [i18n]="{ collapse: 'طي' }" dir="rtl">

Accessibility & keyboard

Tree exposes role="tree", role="treeitem", arrow-key navigation, and Enter/Space to toggle selection. No extra wiring required.

<ngb-tree aria-label="Workspace tree" [nodes]="nodes"></ngb-tree>
Recent events
  • Interact with the tree to see events.

This project is not affiliated with ng-bootstrap or ngx-bootstrap. Those projects focus mainly on Bootstrap components for Angular. ngbootstrap focuses on Angular UI for data-heavy apps, especially Data Grid, Angular-native Form Builder, drag and drop workflows, documentation examples, and performance-focused Angular patterns.