Tree
Description
A component that displays a hierarchical list
A tree displays hierarchical data. Nodes can be expanded or collapsed to reveal nested data.
Supports synchronous and asynchronous loading of child nodes.
API reference
public sealed class Tree : ComponentBase<Tree, HTMLUListElement>, IContainer<Tree.Item, Tree.Item>A vertically-stacked tree view with expand / collapse, keyboard navigation, selection and arbitrary item rendering.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<Tree, HTMLUListElement> → Tree
- Implements
- IContainer<Tree.Item, Tree.Item>
Constructors
| Name | Description |
|---|---|
| Tree | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| SelectedItem | Gets the currently selected item. |
Methods
| Name | Description |
|---|---|
| Render | Renders the component's root HTML element. |
| OnSelected | Registers a callback invoked when the selected event fires. |
| SelectionEnabled | Enables or disables item selection on the tree. |
| Add | Adds the given item to the component. |
| Clear | Clears the component's current state. |
| Replace | Replaces an existing item with a new one. |
| Items | Adds the given items to the component. |
public Tree OnSelected(ComponentEventHandler<Tree, Item> onSelected)Registers a callback invoked when the selected event fires.
public Tree SelectionEnabled(bool enabled = true)Enables or disables item selection on the tree.
public void Replace(Item newComponent, Item oldComponent)Replaces an existing item with a new one.
Events
| Name | Description |
|---|---|
| SelectedItemChanged | Raised when selected item changed occurs. |
Samples
Basic Synchronous Tree
Asynchronous Tree
Selectable Tree
File-System Tree with Selection Events
This sample models a realistic project layout. OnSelected on the Tree fires every time the user clicks an item, so we mirror the path of the selected node in a panel beside the tree.