Tree view

Also called file tree, folder tree, tree navigation, or nested list

A nested list of folders and files that open and close in place, with indent guides and arrow-key navigation, like a code editor’s sidebar.

What is Tree view?

A tree view shows a hierarchy as rows. Each folder has a chevron that turns when it opens, and its children appear beneath it, indented one step, often with a thin vertical guide line that shows which folder they belong to. Clicking a folder toggles it; clicking a file selects it.

Use it for anything that nests more than two levels deep: files in a project, pages in a docs site, categories in a store admin, layers in a design tool. For a single level of grouping, an accordion or a grouped list is simpler.

Follow the ARIA tree pattern so the keyboard works: the list gets role="tree", rows get role="treeitem" with aria-expanded and aria-level, and the whole tree is one tab stop. Up and Down move between visible rows, Right opens a folder or steps into it, Left closes it or jumps to its parent, and Home and End go to the first and last rows.

Open folders with a quick height animation, around 150 to 200ms, and skip it under reduced motion. For very large trees, such as a repository with thousands of files, render only the rows on screen and load a folder’s children the first time it opens.

Often confused with

Accordion
An accordion opens flat sections of content on a page. A tree view nests items many levels deep and lets people move through them with the arrow keys.
All terms

Accordion

A vertical stack of headings that each expand to reveal their content when clicked, so long pages stay short and easy to scan.

Sidebar

A vertical panel along the side of an app that holds the main navigation, often collapsible to a slim strip of icons.

Height auto animation

An animation that opens or closes a panel to the exact height of its content, even though that height is unknown ahead of time.

Focus ring

An outline that marks which element has keyboard focus, so people moving through a page with the Tab key can see where they are.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.