Tree view

A tree view is a UI component that displays hierarchical data in an expandable and collapsible nested structure, allowing users to navigate deep hierarchies by expanding branches and selecting nodes.

What is a tree view in UX design?

A tree view is a UI component that visualizes hierarchical data as a nested structure of expandable and collapsible nodes. Each node can be a leaf node with no children or a branch node with children that are shown or hidden through expand and collapse interactions. Tree views appear in file system browsers, organizational hierarchy visualizations, code editors for project structure, documentation navigation for deep content hierarchies, and any interface where users need to navigate or interact with deeply nested structured data.

When do tree views help users navigate hierarchy?

Tree views work well when the hierarchy is genuine and users need to understand the relationships between levels to accomplish their task. A file system browser where folder nesting represents actual containment relationships benefits from tree view treatment because the hierarchy is meaningful and users need to navigate it to find files. Documentation navigation where chapters contain sections and sections contain subsections can benefit from tree view treatment when users need to understand their position in the hierarchy.

What are the accessibility requirements for tree views?

Tree views are complex interactive components that require careful ARIA implementation. The tree container uses role="tree" and each item uses role="treeitem". Expandable nodes communicate their state using aria-expanded. The currently focused item is indicated with tabindex="0" while all others use tabindex="-1", with focus management on expansion and collapse. Keyboard navigation follows the ARIA specification: arrow keys navigate between items and expand and collapse branches, Enter or Space activates the selected item. This is a complex pattern to implement correctly, and using a well-tested component library rather than building from scratch significantly reduces the risk of accessibility failures.

Related terms

Related guides