Tree

Tree is used to display hierarchical data.

No available options
PREVIEW

Displays hierarchical data with expand and collapse support.

No available options
basic-demo

Custom node content is rendered through the nodeicon slot; the node payload exposes its children and expanded state so the right icon can be chosen.

No available options
content-demo

Toggle icons are customized through the nodetoggleicon slot which receives the expanded state of the node.

No available options
toggleindicator-demo

Tree state can be controlled programmatically with the expandedKeys property that defines the keys that are expanded. This property is a Map instance whose key is the key of a node and value is a boolean. Note that expandedKeys also supports two-way binding with the v-model directive.

No available options
controlled-demo

Single node selection is configured by setting selectionMode as single along with selectionKeys property to manage the selection value binding.

No available options
single-demo

More than one node is selectable by setting selectionMode to multiple. By default in multiple selection mode, metaKey press (e.g. ⌘) is not necessary to add to existing selections. When the optional metaKeySelection is present, behavior is changed in a way that selecting a new node requires meta key to be present. Note that in touch enabled devices, Tree always ignores metaKey.

In multiple selection mode, value binding should be a key-value pair where key is the node key and value is a boolean to indicate selection.

No available options
multiple-demo

Selection of multiple nodes via checkboxes is enabled by configuring selectionMode as checkbox.

In checkbox selection mode, value binding should be a key-value pair where key is the node key and value is an object that has checked and partialChecked properties to represent the checked state of a node object to indicate selection.

No available options
checkbox-demo

A header checkbox can be added to toggle the selection of every node at once. Its checked and indeterminate states are derived from the current selectionKeys.

No available options
selectall-demo

Tree has full keyboard support; arrow keys navigate between nodes, right and left expand and collapse a node and space toggles the selection of the focused node.

↑ ↓ navigate, → expand, ← collapse, Space select
Selected0
No available options
keyboard-demo

Filtering enables searching through the nodes using the built-in filter property.

No options found.
filter-demo

Lazy loading is demonstrated in this example where nodes are loaded on demand when a node is expanded.

No available options
lazy-demo

While data is being fetched, a loading overlay with a spinner can be displayed over the Tree by enabling the loading property.

No available options
loading-overlay-demo

Skeleton placeholders can be rendered for each row while the data is being fetched by displaying a set of empty nodes with a custom node template.

loading-skeleton-demo

A custom placeholder can be displayed when there are no nodes to show using the empty slot.

No folders yet

Create your first folder to start building a tree.

empty-demo

Drag&Drop based reordering is enabled by adding the draggableNodes and droppableNodes properties and definining a two-way model binding to the value option. The optional @node-drop event is available to get notified about the new tree state.

dragdrop-single-demo

Nodes can be transferred between multiple trees as well. The draggableScope and droppableScope properties defines keys to restrict the actions between trees. In this example, nodes can only be transferred from start to the end.

Drag Nodes Here
dragdrop-multiple-demo

An event is provided for each type of user interaction such as expand, collapse and selection.

No available options
event-demo

Screen Reader

Value to describe the component can either be provided with aria-labelledby or aria-label props. The root list element has a tree role whereas each list item has a treeitem role along with aria-label, aria-selected and aria-expanded attributes. In checkbox selection, aria-checked is used instead of aria-selected. The container element of a treenode has the group role. Checkbox and toggle icons are hidden from screen readers as their parent element with treeitem role and attributes are used instead for readers and keyboard support. The aria-setsize, aria-posinset and aria-level attributes are calculated implicitly and added to each treeitem.

Keyboard Support

KeyFunction
tab Moves focus to the first selected node when focus enters the component, if there is none then first element receives the focus. If focus is already inside the component, moves focus to the next focusable element in the page tab sequence.
shift + tab Moves focus to the last selected node when focus enters the component, if there is none then first element receives the focus. If focus is already inside the component, moves focus to the previous focusable element in the page tab sequence.
enterSelects the focused treenode.
spaceSelects the focused treenode.
down arrowMoves focus to the next treenode.
up arrowMoves focus to the previous treenode.
right arrowIf node is closed, opens the node otherwise moves focus to the first child node.
left arrowIf node is open, closes the node otherwise moves focus to the parent node.
Theme Designer