Library Blazor Components TreeView Articles Tutorial

Tutorial

Setup

TreeView is relatively easy to set up. As with many other components, it require a list of items (Items parameter) to be specified and a type of the items (T type parameter).

There is only one requirement, that in order for a class to be rendered inside TreeView, it is necessary to implement ITreeNode interface.

This interface consist only of 2 members: IsExpanded and Children and tells the component whether to render sub items (expanded or collapsed) and list of sub items.

Adding sub items

Adding items is straightforward as it is only necessary to add new items to Children property.

Example

Sign in