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.

Purpose

A hierarchy of rows that open and fold, each with optional selection and its own controls: folders, organisation units, categories. For a flat set, use a List.

Behaviour

  • It follows the tree grid pattern: Up, Down, Home, End and typing move between rows, and Left and Right close, open and move into a row's controls.
  • items are data, and children renders each one, usually as a TreeViewItemContent.
  • hasChildren marks a row whose children aren't loaded. onLoadChildren returns a promise; a loading row shows, and a failure shows a row with a retry.
  • A disabled row can't be selected or activated, and stays reachable by keyboard.

When not to use

For a flat set use a List; for sections of content, an Accordion.

See also

  • List: Rows with headline, overline, supporting text and leading or trailing content (icons, avatars, images, video thumbnails); items can be links, switches, checkboxes or radio buttons, and put in order by drag or a menu.
  • Accordion: A stack of headers that open and fold panels of content, one at a time or several: FAQs, settings groups, product details and filters. Not an M3 component (@windmorph/react-pro).