BOBTreeMenu
Hierarchical navigation with icons, nested groups, vertical or horizontal orientation, and hover or click triggers.
API reference ↗Basic usage
Declare BOBTreeMenuItems — nest them via ChildContent.
RAZOR
<BOBTreeMenu TItem="object" Size="BOBSize.Medium">
<BOBTreeMenuItem Text="Dashboard" Icon="@BOBIconKeys.UI.Home" />
<BOBTreeMenuItem Text="Projects" Icon="@BOBIconKeys.UI.Folder" InitiallyExpanded="true">
<ChildContent>
<BOBTreeMenuItem Text="Active" />
<BOBTreeMenuItem Text="Archived" />
<BOBTreeMenuItem Text="Templates">
<ChildContent>
<BOBTreeMenuItem Text="Blank" />
<BOBTreeMenuItem Text="Starter" />
</ChildContent>
</BOBTreeMenuItem>
</ChildContent>
</BOBTreeMenuItem>
<BOBTreeMenuItem Text="Team" Icon="@BOBIconKeys.UI.Settings" />
</BOBTreeMenu>Horizontal (top bar)
RAZOR
<BOBTreeMenu TItem="object"
Orientation="TreeMenuOrientation.Horizontal"
ExpandMode="TreeMenuExpandMode.Flyout"
Trigger="TreeMenuTrigger.Hover">
<BOBTreeMenuItem Text="File">
<ChildContent>
<BOBTreeMenuItem Text="New" />
<BOBTreeMenuItem Text="Open" />
<BOBTreeMenuItem Text="Save" />
</ChildContent>
</BOBTreeMenuItem>
<BOBTreeMenuItem Text="Edit">
<ChildContent>
<BOBTreeMenuItem Text="Undo" />
<BOBTreeMenuItem Text="Redo" />
</ChildContent>
</BOBTreeMenuItem>
<BOBTreeMenuItem Text="Help" />
</BOBTreeMenu>Hover trigger
Open submenus on hover instead of click.
RAZOR
<BOBTreeMenu TItem="object" Trigger="TreeMenuTrigger.Hover" HoverOpenDelay="100">
<BOBTreeMenuItem Text="Hover me" Icon="@BOBIconKeys.UI.Settings">
<ChildContent>
<BOBTreeMenuItem Text="Profile" />
<BOBTreeMenuItem Text="Appearance" />
<BOBTreeMenuItem Text="Account" />
</ChildContent>
</BOBTreeMenuItem>
</BOBTreeMenu>Properties
BOBTreeMenu
20 rows.
| Property | Type | Default | Description |
|---|---|---|---|
ChildContent | RenderFragment? | | Content rendered inside the component. |
Items | IEnumerable<TItem>? | | Root items the menu renders. |
KeySelector | Func<TItem, string>? | | Returns a stable key for an item. Required for keyboard navigation and lazy loading. |
ChildrenSelector | Func<TItem, IEnumerable<TItem>?>? | | Returns the children of an item. |
HasChildrenSelector | Func<TItem, bool>? | | Returns whether an item has children without loading them. Enables lazy expansion via . |
OnLoadChildren | Func<TItem, Task<IEnumerable<TItem>>>? | | Called the first time a node is expanded with no in-memory children. Result is cached on the menu. |
NodeTemplate | RenderFragment<TreeMenuNode<TItem>>? | | Custom template for rendering the Node. |
Cache | TreeNodeCache<TItem>? | | Cache. |
ExpandedKeys | HashSet<string>? | | ExpandedKeys. |
ExpandedKeysChanged | EventCallback<HashSet<string>> | | ExpandedKeysChanged. |
ExpandAll | bool | | ExpandAll. |
Orientation | TreeMenuOrientation | TreeMenuOrientation.Vertical | Orientation. |
Trigger | TreeMenuTrigger | TreeMenuTrigger.Click | Trigger. |
ExpandMode | TreeMenuExpandMode | TreeMenuExpandMode.Inline | ExpandMode. |
Size | BOBSize | BOBSize.Medium | Visual size of the component. |
Collapsible | bool | true | Collapsible. |
HoverOpenDelay | int | 150 | HoverOpenDelay. |
HoverCloseDelay | int | 300 | HoverCloseDelay. |
OnNodeClick | EventCallback<TreeNodeEventArgs<TreeMenuNode<TItem>>> | | Raised when the NodeClick event occurs. |
OnNavigate | EventCallback<string> | | Raised when the Navigate event occurs. |
BOBTreeMenuItem
12 rows.
| Property | Type | Default | Description |
|---|---|---|---|
Href | string? | | Href. |
Target | string? | | Target. |
Match | NavLinkMatch | NavLinkMatch.Prefix | Match. |
OnClick | EventCallback | | Raised when the component is clicked. |
ChildContent | RenderFragment? | | Child nodes nested inside this node. Each child registers itself recursively against the same tree. |
Data | Object? | | Arbitrary payload associated with the node and surfaced through the registration to consumers. |
Disabled | Boolean | | When true, the node is rendered in a disabled state and ignores activation. |
Icon | IconKey? | | Material icon name displayed alongside the node text. |
InitiallyExpanded | Boolean | | When true, the node is expanded the first time the tree renders. |
Key | String? | | Stable identifier for the node. When omitted, a key is derived from the node's position in the tree. |
NodeContent | RenderFragment? | | Optional render fragment that replaces the default text/icon layout for this node. |
Text | String? | | Visible label of the node. |