TreeView

View in LexiconBeta

A tree view is a component based on nodes that are shown in a hierarchical structure.

installyarn add @clayui/core
versionNPM Version
useimport {TreeView} from '@clayui/core';

Treeview

The treeview provides a way to display information in a hierarchical structure by using collapsible items (nodes). You can navigate between these items using either your mouse device or keyboard. The most common example of a treeview is a folder structure for file systems, but it can be used for showing any hierarchical relationships.

Treeview Link indentation must be provided by javascript through inline styles, use the styles padding-left: 24px; on .treeview-link and margin-left: -24px on .treeview-link > .c-inner. Increase the indentation for each level by increasing or decreasing padding-left or margin-left by 24px.

Snippet

Treeview Group

The class treeview-group must be applied to all nested ul elements inside treeview. This class helps provide the proper spacing for nested treeview-links.

Snippet

Treeview Item

The class treeview-item must be applied to all li elements. This class helps provide the proper spacing for nested treeview-links.

Snippet

This is the container for all nodes inside treeview. If there are auxiliary controls inside the treeview-link (e.g., a or button) it is recommended to use a div element with the tabIndex attribute.

Snippet

The modifier class disabled adds disabled styles to treeview-link. The class does not add disabled styles to form elements, links, or buttons inside. Those must be disabled individually.

Snippet

Component Expander

The expander is used to expand or collapse the nodes and serves as an indicator for those states. The class component-expander marks the button as the toggle. The class component-expanded-d-none on lexicon-icon hides the icon when tree node is expanded.

Snippet

Component Action

The action button(s) are monospaced buttons used to supply additional features to a tree node, such as removal or a dropdown.

Snippet

Treeview Dragging

The modifier class treeview-dragging displays an indicator showing the item being dragged.

Liferay Drive

Treeview Dropping Bottom

The modifier class treeview-dropping-bottom adds a visual indicator to the bottom of treeview-link to show where a dragged treeview-link will be inserted.

Snippet

Treeview Dropping Top

The modifier class treeview-dropping-top adds a visual indicator to the bottom of treeview-link to show where a dragged treeview-link will be inserted.

Snippet

Treeview Dropping Middle

The modifier class treeview-dropping-middle adds a visual indicator around the treeview-link to show where a dragged treeview-link will be nested.

Snippet

Variations

Show Component Expander on Hover

The class show-component-expander-on-hover displays the component-expander when the mouse hovers over the treeview component.

Snippet

Show Quick Actions on Hover

The class show-quick-actions-on-hover on treeview will hide all quick-action-item’s except when treeview-link is hovered or focused.

Snippet

Treeview Light

A treeview variation for light colored backgrounds.

Snippet

Treeview Dark

A treeview variation for dark colored backgrounds.

Snippet

Edit this page on GitHub

Contributors

Matuzalém Teles

Last edited May 12, 2025 at 7:56:02 PM