packages/components/eui-tree-list/eui-tree-list.component.ts
Hierarchical tree list component for displaying nested navigation or content structures. Provides expand/collapse functionality, filtering, and keyboard navigation support. Supports optional toolbar with expand-all, collapse-all, and filter controls. Implements ARIA tree role for accessibility compliance. Commonly used for navigation menus, file explorers, or any hierarchical list display.
<eui-tree-list [isShowToolbar]="true">
<eui-tree-list-item label="Documents">
<eui-tree-list-item label="Reports" />
<eui-tree-list-item label="Invoices" />
</eui-tree-list-item>
<eui-tree-list-item label="Images">
<eui-tree-list-item label="Photos" />
</eui-tree-list-item>
</eui-tree-list><eui-tree-list
[isShowToolbar]="true"
[filterFunction]="customFilter">
<!-- tree items -->
</eui-tree-list>customFilter = (params: EuiTreeListFilterParams) => {
return params.item.label.toLowerCase().includes(params.keyword.toLowerCase());
};
| encapsulation | ViewEncapsulation.None |
| selector | eui-tree-list |
| imports |
EuiTreeListToolbarComponent
TranslateModule
|
| templateUrl | ./eui-tree-list.component.html |
| styleUrl | ./eui-tree-list.scss |
Properties |
|
Methods |
|
Inputs |
Outputs |
Accessors |
| ariaLabel |
Type : string
|
Default value : ''
|
|
Sets the aria-label attribute for the tree list |
| collapseAllLabel |
Type : string
|
|
Sets the label for the collapse-all button |
| e2eAttr |
Type : string
|
Default value : 'eui-tree-list'
|
|
Sets the end-to-end attribute for the tree list |
| expandAllLabel |
Type : string
|
|
Sets the label for the expand-all button |
| filterFunction |
Type : function
|
|
Function to filter the tree list items based on the provided params |
| filterLabel |
Type : string
|
|
Sets the label for the filter input |
| hasItemsUrl |
Type : boolean
|
Default value : false
|
| isExpanded |
Type : boolean
|
Default value : false
|
|
Sets the expanded state of the tree list |
| isShowToolbar |
Type : boolean
|
Default value : false
|
|
Option to show the toolbar |
| isShowToolbarToggle |
Type : boolean
|
Default value : true
|
| tabindex |
Type : string
|
Default value : '0'
|
|
Sets the tabindex attribute to handle the focus state |
| toolbarFilterValue |
Type : string
|
Default value : ''
|
|
Sets the filter value of the toolbar |
| collapseAll |
Type : EventEmitter
|
|
Event emitted upon collapsing all items. |
| expandAll |
Type : EventEmitter
|
|
Event emitted upon expanding all items. |
| filter |
Type : EventEmitter
|
|
Event that emits the filter value upon filtering. |
| itemSelected |
Type : EventEmitter
|
| Public disableFocus |
disableFocus()
|
|
Method that makes the tree list not focusable.
Returns :
void
|
| Public focus |
focus()
|
|
Method that puts the focus on the first child tree item.
Returns :
void
|
| Public focusOnNextTreeItem | ||||||||
focusOnNextTreeItem(currentTreeListItem: EuiTreeListItemComponent)
|
||||||||
|
Method used to focus on the next tree item in the list.
Parameters :
Returns :
boolean
|
| Public focusOnPreviousTreeItem | ||||||||
focusOnPreviousTreeItem(currentTreeListItem: EuiTreeListItemComponent)
|
||||||||
|
Method used to focus on the previous tree item in the list.
Parameters :
Returns :
boolean
|
| onCollapseAll | ||||||
onCollapseAll(event: Event)
|
||||||
|
Method that sets the collapsed state and emits the collapse-all event.
Parameters :
Returns :
void
|
| onExpandAll | ||||||
onExpandAll(event: Event)
|
||||||
|
Method that sets the expanded state and emits the expand-all event.
Parameters :
Returns :
void
|
| onFilter | ||||||||
onFilter(filterValue: string)
|
||||||||
|
Method that handles the visibility of the items based on the filter value and emits the filter event.
Parameters :
Returns :
void
|
| onFocus |
| This method is not used anymore and will be removed in the next major version. You can use the `focus()` method instead. |
onFocus()
|
|
Returns :
void
|
| Public setExpandedState | ||||||
setExpandedState(state: boolean)
|
||||||
|
Method that sets the expanded state of the tree list items.
Parameters :
Returns :
void
|
| Public setVisibleState | ||||||
setVisibleState(state: boolean)
|
||||||
|
Method that sets the visibility state of the tree list items.
Parameters :
Returns :
void
|
| Public ariaOwns |
Type : string
|
Default value : ''
|
| Public ariaRoleTree |
Type : string
|
Default value : 'tree'
|
| Public classes |
Type : string
|
Default value : ''
|
| items |
Type : QueryList<EuiTreeListItemComponent>
|
Decorators :
@ContentChildren(undefined)
|
| Public originalTabindex |
Type : string
|
Default value : '0'
|
| hasExpandAllLabel |
gethasExpandAllLabel()
|
|
Getter function that returns true if the expandAllLabel exists.
Returns :
boolean
|
| hasCollapseAllLabel |
gethasCollapseAllLabel()
|
|
Getter function that returns true if the collapseAllLabel exists.
Returns :
boolean
|