Tree navigation design: distinguish depth, expansion and selection
Use tree navigation design to make parent-child depth, expanded branches and selected items distinct, with readable labels and a clear keyboard focus state.
Tree navigation design should make hierarchy, expansion and selection visually distinct. Show which items contain children, keep the current item identifiable and provide a clear focus state as people move through the structure. A tree is useful for genuinely nested material, but it should not become a decorative tangle of arrows and indentation that requires visitors to open every branch before understanding where they are.
Confirm that the hierarchy deserves a tree
Begin with the organisation of the material and the task. A file workspace or nested category browser may benefit from a tree. A short set of ordinary website links may be clearer as simpler navigation.
Do not choose the pattern solely because the information has several categories. The visitor needs to understand the parent-child relationship and use it to find something. If the structure is unclear, drawing connector lines will not resolve the underlying organisation.
The navigation design guide helps assess the broader structure. This review concerns the visual states of a nested interaction once that structure is justified.
Use indentation consistently
Set a clear step between hierarchy levels and keep labels aligned within each level. The spacing should make the parent-child relationship visible without consuming so much width that deeper labels become unreadable.
For a hypothetical document workspace, a policy folder may contain departmental folders and individual files. The design should let people distinguish those levels without needing to count decorative lines.
Test the deepest valid branch with real names. A tree that looks elegant at two levels may collapse into a narrow column at six. If the hierarchy is very deep, consider a different view or a stronger route to the current location rather than endlessly increasing indentation.
Distinguish branches from end items
Show an expansion affordance only where an item actually has children. An identical arrow beside every item invites actions that cannot produce a result.
Keep the expanded state apparent. The arrow or other affordance can change orientation, while the visible children reinforce what happened. Avoid making selection and expansion look like the same state when they perform different actions.
If a parent can both open content and expand its children, define how those actions are separated. The implemented interaction should match the visual boundary rather than making one small target perform two unpredictable jobs.
Keep selection and focus readable
A selected item identifies the current content or chosen object. Keyboard focus identifies where the next action occurs. Their treatment needs to remain clear when they are not on the same row.
Use more than colour alone for an important current state. A background, marker, weight or other consistent cue can help, but it should not overwhelm the label or merge with the indentation guides.
The colour and contrast guide helps establish the palette. Check selected, focused and expanded states together on the intended panel background, not as isolated swatches.
Plan for long labels and crowded branches
Long names should remain identifiable. If truncation is necessary, ensure another suitable route reveals the full name and do not remove the only word that distinguishes neighbouring items.
Keep row spacing dependable when labels wrap. A wrapped child should not appear aligned with its parent's next sibling. Icons should support a meaningful distinction rather than create a separate decorative column that competes with the labels.
Where additional item actions exist, keep them visually separate from the tree's expansion controls. A row containing a branch arrow, selection, an action menu and a checkbox needs a particularly careful interaction review.
If children load only after a branch opens, show that waiting state clearly. Do not immediately present an empty branch as though it has no contents while the request is still running. A failed request also needs a different treatment from a genuinely empty branch.
Make hidden current locations understandable
Decide what happens when the current item lies inside a collapsed branch. The interface may reveal its ancestors or provide another clear indication of the location, depending on the task.
Do not leave the detail pane showing one item while the tree gives no usable clue to where it sits. The relationship should remain understandable after returning to the view or changing another filter.
Use design quality assurance to test an expanded deep branch, a collapsed ancestor, keyboard movement and a narrow layout. Agree the implemented semantics and operation with the developer; a nested-looking screenshot does not demonstrate a working tree interaction.
Frequently asked questions
Should every website menu use a tree widget?
No. A tree introduces a specific interaction model and can add unnecessary complexity. Choose it for a task that benefits from navigating a genuine hierarchy, rather than as a visual style for ordinary links.
Can clicking a parent both select and expand it?
That can be a deliberate model, but the behaviour and visual state must be clear. If the actions differ, provide an understandable boundary and test how people discover the intended route.
Are connector lines necessary to show the hierarchy?
Not always. Consistent indentation and clear branch states may be sufficient. Lines can help a complex structure, but excessive decoration can make labels harder to scan. Compare treatments with the actual depth and content.
HELP US IMPROVE
Was this article useful?
Your feedback helps shape future coverage.