Navigation

Tree

Nested details with chevrons and indent guides. For files, folders and anything hierarchical.

Examples

Tree

Anatomy

ul.treeThe root list, unstyled.
li > details > summaryA branch. The summary gets a chevron that turns when open.
details > ulThe branch's children, indented with a hairline guide.
li > a, li > spanA leaf: a link, or a span for something not navigable.

API

AttributeValuesDescription
aria-currentbooleanOn a leaf link: accent text, tint and an accent edge. Use page for navigation, true for a selection.
openbooleanOn a <details>: the branch starts expanded.

Accessibility

  • This is nested disclosures, not an ARIA tree: there is no arrow-key navigation, and each summary announces its own expanded state.
  • Don't add role="tree" without scripting the tree keyboard pattern to go with it.
  • Wrap it in a labelled <nav> when it is site navigation.
KeyEffect
Enter / SpaceOn a summary: opens or closes the branch (native).
Tab / ShiftTabMoves through summaries and links in order.
Jump to
ProportionFoundations
MaterialFoundations
PresetsFoundations
ShellLayouts · Application
Container and stacksLayouts · Pages
SplitLayouts · Pages
Grid, bento, masonryLayouts · Pages
Switcher and rowLayouts · Pages
↑↓Move↵OpenescClose