Skip to content
+

Simple Tree View - Customization

Learn how to customize the Simple Tree View component.

Basics

Custom icons

Use the collapseIcon slot, the expandIcon slot and the defaultEndIcon prop to customize SimpleTreeView icons. The demo below shows how to add icons using both an existing icon library, such as Material Icons, and creating an icon from scratch using Material UI's SvgIcon.

  • Data Grid
    • @mui/x-data-grid
    • @mui/x-data-grid-pro
    • @mui/x-data-grid-premium

Custom toggle animations

Use the groupTransition slot on SimpleTreeView to pass a component that handles your animation.

The demo below is animated using Material UI's Collapse component together with the react-spring library.

  • Data Grid
    • @mui/x-data-grid
    • @mui/x-data-grid-pro
    • @mui/x-data-grid-premium

Custom styling

Use treeItemClasses to target internal elements of a TreeItem and change its styles.

  • Data Grid
    • @mui/x-data-grid
    • @mui/x-data-grid-pro
    • @mui/x-data-grid-premium

Custom Tree Item

You can use the TreeItem customization API to build new layouts and manage behaviors.

See Tree Item customization to learn more about the anatomy of TreeItem and the customization utilities provided.

Headless API

Use the useTreeItem() hook to create your own component. The demo below shows how to add an avatar and custom typography elements.

  • B
    Bailey Monroe
    • F
      Freddie Reed

Common examples

Connection border

Target the treeItemClasses.groupTransition class to add connection borders between TreeItem components.

  • Main
    • Hello
    • Subtree with children
      • Hello
      • Hello
    • World
    • Something something

Gmail clone

The Gmail sidebar is one of the most well-known examples of a tree view. The demo below shows how to recreate it with SimpleTreeView:

  • All Mail

  • Trash

  • Categories

    • Social

      90
    • Updates

      2,294
    • Forums

      3,566
    • Promotions

      733
  • History

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.