Skip to content

Tree view

Pro

A hierarchy of rows that open and fold, with selection, their own controls and children that load. Not an M3 component (@windmorph/react-pro).

import { TreeView, TreeViewItemContent } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Keyboard

Tree view keyboard
KeyAction
TabMoves into and out of the tree, which is one tab stop.
Arrow Up or Arrow DownMove between rows.
Arrow RightOpens a closed row, then moves into its controls.
Arrow LeftCloses an open row, or moves out of its controls.
Home or EndMove to the first or last row.
Enter or SpaceActivates or selects the row.
  • Typing moves to the next row starting with those letters.
  • Left and Right mirror in right to left.

Screen reader

Role
A treegrid with row and gridcell.
Accessible name
From aria-label or aria-labelledby, which the types require. Each row is named by its textValue.
States announced
aria-expanded, aria-level, aria-posinset, aria-setsize and aria-selected.

A loading or failed row is a real row, so a keyboard can reach its retry.

Focus

Each row shows the M3 focus indicator from the keyboard.

Touch target

Rows and expand buttons are 48px at density 0 and lose 4px a density step.

Motion

  • The chevron turns on the fast spatial spring and snaps under reduced motion.
  • In forced colours a selected row keeps an edge.

What you need to do

  • Give the tree a name, and return a useful textValue for each row.
  • Name any control in a row after that row.