Package org.patternfly.component.tree


package org.patternfly.component.tree
Provides a tree view component for displaying hierarchical data.

A tree view renders data in a hierarchical structure with expandable/collapsible nodes. It supports selectable items, checkboxes, custom icons, action buttons, and lazy loading of child items. Tree view items can be nested to any depth.

Key Classes

Usage

Create a basic tree view with nested items:

 import static org.patternfly.component.tree.TreeView.treeView;
 import static org.patternfly.component.tree.TreeViewItem.treeViewItem;

 TreeView tree = treeView()
         .addItem(treeViewItem("app-launcher", "Application launcher")
                 .addItem(treeViewItem("app-1", "Application 1")
                         .addItem(treeViewItem("settings", "Settings"))
                         .addItem(treeViewItem("current", "Current")))
                 .addItem(treeViewItem("app-2", "Application 2")))
         .addItem(treeViewItem("cost", "Cost management")
                 .addItem(treeViewItem("app-3", "Application 3")));

Create a tree view with checkboxes:

 import static org.patternfly.component.tree.TreeView.treeView;
 import static org.patternfly.component.tree.TreeViewItem.treeViewItem;
 import static org.patternfly.component.tree.TreeViewType.checkboxes;

 TreeView checkboxTree = treeView(checkboxes)
         .addItem(treeViewItem("item-1", "Item 1")
                 .addItem(treeViewItem("child-1", "Child 1"))
                 .addItem(treeViewItem("child-2", "Child 2")))
         .addItem(treeViewItem("item-2", "Item 2"));
See Also:
  • Class
    Description
    A tree view is a structure that displays data in a hierarchical view.
    A tree view item within a TreeView component.