Skip to content
SkillCodex
Menu

Tree view

Tree view

A composite widget for navigating hierarchical items whose parent nodes can expand or collapse their child groups.

Try the component
Context, sources and actions
Sources and revision
Updated
Version
v1.0.26 · r1
Sources
5 sources
Status
Published
Read the sources

You may have searched for: browse folders in a hierarchyexpand a parent to reveal childrencollapse nested branches

All phrasings
Save and share

Recognize

Structure and explore data

Try it

Should people read tabular data, interact cell by cell, or expand a hierarchy?

Tree view

Shared trial context

A workspace presents a large information set whose structure and interaction model determine how people scan, edit, or expand it.

Tree view

Mission

Tree view

Enter once, expand Projects with Right Arrow, move to Design, select it, then return to and collapse the parent.

Archive
Navigation point: Projects

Live result

Projects is the managed entry point and remains collapsed; its children are outside navigation.

Step 1 of 3

Try

Try the component. Your live result appears just above. Move on at your own pace.

Behavior and edge case
What to observe
Projects is focused and collapsed; hidden children are absent from navigation.
Edge case
Leaf nodes never expose aria-expanded, and children of collapsed parents leave navigation and focus.

What this example shows

Tree view combines hierarchy, composite focus, and parent expansion; Data grid navigates tabular cells, while a nested list or Accordion lacks the tree’s unified keyboard model.

Which fits your need?

Tree view

People navigate a true parent-child hierarchy

Table

People compare values across rows and columns

Which component will you use here?
Difference and sources

Tree view combines hierarchy, composite focus, and parent expansion; Data grid navigates tabular cells, while a nested list or Accordion lacks the tree’s unified keyboard model.

Read the sources

    Parts of the specimen

    Select a numbered marker on the schematic, or use the list below, to see its role. The schematic shows the concept's representative state.

    Tree

    The composite hierarchy that owns its visible items and focus model.

    Position in the atlas

    Relationship map

    Locate the chapter, neighboring concepts, and the next useful decision.

    • Chapter

      Structure and explore data

      Tree view belongs to this comparison group.

    • Do not confuse

      Table

      Choose Tree view if items belong to parents and the user drills down through levels. Choose Table if the user compares values across rows and columns without a parent-child structure.

      Compare this pair
    • Do not confuse

      Data grid

      Choose Tree view if the structure is a real hierarchy, like folders, that the user expands level by level. Choose Data grid if the data is tabular and the user edits or navigates many cells efficiently.

      Compare this pair
    • Next step

      Compare the concepts in the chapter before choosing an implementation.

      Open the chapter

    In your own words

    Understand

    What people describe

    Documented aliases: tree, hierarchical navigator, outline view

    • browse folders in a hierarchy
    • expand a parent to reveal children
    • collapse nested branches
    • move through visible nodes with arrow keys
    • select one item in a file tree
    • jump to a node by typing its name

    Choose

    Use it when

    • People navigate a true parent-child hierarchy
    • Branches need in-place expansion and efficient keyboard travel

    Avoid it when

    • Items form a flat list
    • Content is a static document outline or independent disclosures

    Compare

    Compare similar concepts

    Verification checklist

    Try these actions in the lab, then check the same behaviours in your agent’s result. Adapt the example names to your interface.

    1. 1. Do this

      Reach the tree with Tab and use the right arrow to expand a parent, then move down through its children.

      Expected result

      The expanded state is clear, and keyboard navigation follows the visible hierarchy.

    2. 2. Do this

      Use the left arrow to return to a parent or collapse it, then continue with the up and down arrows.

      Expected result

      Collapsed children are skipped, focus remains on a visible item, and a leaf is not presented as expandable.

    3. 3. Do this

      Activate a leaf’s default action with Enter, then use Tab to leave the tree.

      Expected result

      The intended item opens or acts according to the declared model, focus and selection remain distinguishable, and Tab leaves the tree normally.

    Full contract
    1. 1The tree has an accessible name
    2. 2Every node is a treeitem in the correct group
    3. 3Only parents expose aria-expanded
    4. 4One composite focus strategy is used
    5. 5Focus and selection remain distinct

    Understand → Recognize → Choose → Compare

    Pack for your agent

    Pre-written instructions to paste into your agent. Copying executes nothing.

    Implement correctly

    Build Tree view without breaking its behavior

    # Implement Tree view in your agent
    
    ## Objective
    Implement Tree view for this verified behavior: A composite widget for navigating hierarchical items whose parent nodes can expand or collapse their child groups.
    
    ## Prerequisites
    - Inspect the repository, design system, and existing tests first.
    - Preserve unrelated changes and keep the file scope bounded.
    - Confirm that Tree view matches the need before writing code.
    
    ## Required behavior
    - Up and Down move among visible items; Left and Right move across parent-child levels.
    - A parent item exposes or hides its child group while focus and selection remain distinct.
    
    ## States to cover
    - Tree idle
    - Collapsed parent focused
    - Expanded parent focused
    - Child focused
    - Child selected
    
    ## Accessibility
    - ARIA role: tree > treeitem + group
    - The primary control or named region for Tree view has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    - Use roving tabindex or aria-activedescendant consistently, and keep visible focus distinct from aria-selected or aria-checked.
    - The tree is not dismissed; Left Arrow collapses an open parent, and Escape is not a required tree command.
    - Each treeitem exposes its name, level, position, expanded state when it is a parent, and one consistent selection property; end nodes never expose aria-expanded.
    - Tab enters the tree once
    - Up and Down move among visible nodes
    - Right opens a parent or moves to its first child; Left closes or returns to the parent
    - Home and End reach the first and last visible nodes; type-ahead finds a matching node
    - Enter performs the default action and selection keys follow the declared model
    
    ## When not to use
    - Items form a flat list
    - Content is a static document outline or independent disclosures
    
    ## Acceptance criteria
    - The tree has an accessible name
    - Every node is a treeitem in the correct group
    - Only parents expose aria-expanded
    - One composite focus strategy is used
    - Focus and selection remain distinct
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The need is tied to canonical behavior before any technical choice.
    • States, accessibility, and non-goals prevent a merely visual implementation.
    • Acceptance criteria and the output format make verification observable.

    Try next

    Verify Tree view on a real journey

    # Verify Tree view after implementation
    
    ## Objective
    Audit the Tree view implementation against its behavior, states, and accessibility requirements without changing it automatically.
    
    ## Checks
    - Replay the smallest representative journey.
    - Check keyboard behavior, focus, accessible name, and announcements.
    - Tie each gap to a specific acceptance criterion.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:e0b1ec6b304aa4174ae6a1c3077283244ddbf9070ef67bdfdf429dda3a9638fc

    Diagnose a problem

    Find and fix the Tree view defect

    # Debug Tree view in your agent
    
    ## Observed symptom
    [DESCRIBE THE SYMPTOM HERE]
    
    ## Observable checks
    - Reproduce the issue with the smallest relevant journey.
    - Compare behavior with the documented states and transitions for Tree view.
    - Verify keyboard behavior, focus, accessible name, and announcements.
    
    ## Possible causes
    - The chosen primitive does not match the expected behavior.
    - A state, transition, or focus return is missing.
    - A neighboring component captures an event or hides an accessible signal.
    
    ## Bounded corrections
    - Fix the reproduced cause without recreating neighboring components.
    - Preserve the public contract and add a focused regression test.
    - Do not install dependencies or change remote state without authorization.
    
    ## Final verification
    - The tree has an accessible name
    - Every node is a treeitem in the correct group
    - Only parents expose aria-expanded
    - One composite focus strategy is used
    - Focus and selection remain distinct
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The explicit symptom prevents starting from an assumed fix.
    • Checks separate behavior, accessibility, and neighboring interference.
    • The fix stays bounded and must produce regression evidence.

    Try next

    Lock in the Tree view fix

    # Prevent the Tree view regression
    
    ## Objective
    Turn the reproduced cause into a focused regression test and compare Tree view with neighboring concepts before widening the fix.
    
    ## Checks
    - Prove that the test fails before the fix.
    - Prove that it passes after the bounded fix.
    - Verify that no neighboring component changed behavior.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:2fbbe0eca63c99c1f39053fb22c6eb0cd468bbf4bcb4c2a724db45d82aefadcc

    Full entry, saving and provenance

    Pre-written instruction by SkillCodex — your request is neither sent nor used to adapt this text; no content is generated, and copying executes nothing.

    Pack digest: sha256:f8abb2783dfbbc0b5bf6aa68cdaa411ad3dcf0b581011e33329d5aacba911310

    In code

    TechnologyPrimitiveVersionCaveat
    Web platform

    nested elements with managed item focus

    NativeARIA tree requires a complete composite keyboard model. A simple nested navigation list should remain a list when that complexity is unnecessary.

    Technical details

    Behaviors

    • Navigate the hierarchy

      Up and Down move among visible items; Left and Right move across parent-child levels.

    • Expand or collapse a branch

      A parent item exposes or hides its child group while focus and selection remain distinct.

    States

    • Tree idle

      Tree idle

    • Collapsed parent focused

      Collapsed parent focused

    • Expanded parent focused

      Expanded parent focused

    • Child focused

      Child focused

    • Child selected

      Child selected

    State transitions

    • Tree idle → Collapsed parent focused

      Tab focuses the selected node or the first node when none is selected.

    • Collapsed parent focused → Expanded parent focused

      Right Arrow opens the closed parent without moving focus.

    • Expanded parent focused → Child focused

      Right Arrow on the open parent moves focus to its first child.

    • Child focused → Child selected

      Enter performs the default action or Space selects under the declared selection model.

    • Child selected → Tree idle

      Reset restores the collapsed tree and clears specimen selection.

    Test scenarios

    Context
    A file navigator contains a Projects parent with a Design child.
    Mission
    Enter once, expand Projects with Right Arrow, move to Design, select it, then return to and collapse the parent.
    Primary state
    Projects is focused and collapsed; hidden children are absent from navigation.
    Edge case
    Leaf nodes never expose aria-expanded, and children of collapsed parents leave navigation and focus.

    Visual signals

    • Indentation exposes hierarchy levels
    • Parent items have expansion indicators
    • Focus and selection use different cues

    Behavioral signals

    • Right and Left cross parent-child levels
    • Up and Down visit visible nodes only
    • Expansion never silently changes selection

    Accessibility

    Role
    tree > treeitem + group
    Accessible name
    The primary control or named region for Tree view has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    Focus
    Use roving tabindex or aria-activedescendant consistently, and keep visible focus distinct from aria-selected or aria-checked.
    Dismissal
    The tree is not dismissed; Left Arrow collapses an open parent, and Escape is not a required tree command.
    Scroll
    Expanding, collapsing, and navigating the hierarchy keep the focused item visible while nested overflow remains predictable.
    Announcement
    Each treeitem exposes its name, level, position, expanded state when it is a parent, and one consistent selection property; end nodes never expose aria-expanded.
    Keyboard
    • Tab enters the tree once
    • Up and Down move among visible nodes
    • Right opens a parent or moves to its first child; Left closes or returns to the parent
    • Home and End reach the first and last visible nodes; type-ahead finds a matching node
    • Enter performs the default action and selection keys follow the declared model

    Bindings

    Open the HTML, ARIA, Radix, and shadcn matrix
    • nested elements with managed item focus

      implementationKind
      custom
      nativeElement
      nested elements with managed item focus
      ariaPattern
      tree with treeitem and group
      radixPrimitive
      Not applicable
      shadcnRecipe
      Not applicable
      runtimeDependency
      Not applicable
      packageName
      Not applicable
      exportName
      Not applicable
      exactVersion
      Not applicable
      status
      exception
      sourceId
      source-ui-aria-tree-view
      deprecationStatus
      active
      replacement
      Not applicable
      validFrom
      Not applicable
      validUntil
      Not applicable

      Equivalence caveat: ARIA tree requires a complete composite keyboard model. A simple nested navigation list should remain a list when that complexity is unnecessary.

      Verify binding source

    Sources

    • WAI-ARIA APG: Tree View Pattern
      sourceId
      source-ui-aria-tree-view
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/ARIA/apg/patterns/treeview/
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-08-07T07:06:02Z
      consultedAt
      2026-08-10
      license
      Not stated
      contentDigest
      sha256:5890fd989b1523d4392b72deed8f7ab09d8c76fcc39da86414d9c7d80d9d499d
      status
      verified

      Claim covered: Tree view: informative APG guidance for the tree view pattern: roles, states, relationships, and keyboard interaction.

    • WAI-ARIA 1.2: Roles Model
      sourceId
      source-ui-wai-aria-roles
      kind
      standard
      canonicalUrl
      https://www.w3.org/TR/wai-aria-1.2/#roles
      publisher
      W3C WAI
      sourceRevision
      W3C-REC-wai-aria-1.2-20230606
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:c0fea16fc747779569ab754d2d25bca3e2b7e8a673b8ef5362aeb9ebc73a4849
      status
      verified

      Claim covered: Tree view: normative ARIA role definitions and constraints for the stated accessible role.

    • WCAG 2.2: Focus Appearance
      sourceId
      source-ui-wcag-understanding-focus-appearance
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-02T10:07:49Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:fdcf316a1f0e3cc758eda9618322d132862124ff0a3f3b1a3acbf20daf804ff0
      status
      verified

      Claim covered: Tree view: informative WCAG guidance for evaluating visible keyboard focus appearance.

    • WAI-ARIA 1.2: Live Region Attributes
      sourceId
      source-ui-wai-aria-live-regions
      kind
      standard
      canonicalUrl
      https://www.w3.org/TR/wai-aria-1.2/#attrs_liveregions
      publisher
      W3C WAI
      sourceRevision
      W3C-REC-wai-aria-1.2-20230606
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:c0fea16fc747779569ab754d2d25bca3e2b7e8a673b8ef5362aeb9ebc73a4849
      status
      verified

      Claim covered: Tree view: normative live-region properties for status announcement behavior.

    • WCAG 2.2: Status Messages
      sourceId
      source-ui-wcag-understanding-status-messages
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-02T10:07:49Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:cf2a8c16b20c1a94164c9a37e2b3f15d9a7d3f47d88385d47432d6a29655609e
      status
      verified

      Claim covered: Tree view: informative WCAG guidance for status messages announced without moving focus.