Trees

A guide to creating a custom Tree in Umbraco

circle-info

New to sidebar navigation? Read Menus and Menu Items first. For basic, static navigation you can use Menu Items alone. Trees are for data-driven hierarchical structures - use them when your Menu needs to display dynamic content from an API.

circle-exclamation

Populating Trees

Trees get their data from a Repository. The Repository implements methods to return Tree Items and is referenced by the Tree Manifest via repositoryAlias.

Register the Repository

{
    type: 'repository',
    alias: 'My.Tree.Repository',
    name: 'My Tree Repository',
    api: () => import('./my-tree.repository.js'),
}

Repository Implementation

Create a Repository that implements the TreeRepository interface. The interface below is simplified for clarity and omits return types and arguments. See full interfaces in the UI API Documentationarrow-up-right

For detailed implementation guidance, see:

  • Tree Repository - Full repository implementation with static data example.

  • Tree Models - UmbTreeItemModel and UmbTreeRootModel interfaces.


Displaying Trees

Tree Manifest

Register your tree with a Manifest. The repositoryAlias links to how the Tree gets its data:

Tree Item Manifest

Tree-items define how individual items render. Use kind: 'default' for standard rendering:

circle-info

Include both your root entity type and item entity type in forEntityTypes so the Tree Item renderer handles all nodes in your Tree.

Standalone Rendering

Trees can be rendered directly in custom components using the <umb-tree> element:

Connecting to a Menu

Trees can also provide hierarchical data to Menu Items, which display the navigation you see in the Backoffice Section Sidebar. To register your Tree-based Menu Item use the kind: 'tree' in the Menu Item Manifest.

Examples of built-in Menus include:

  • Content - Umb.Menu.Content

  • Media - Umb.Menu.Media

  • Advanced Settings - Umb.Menu.AdvancedSettings

See Menu Items (Tree kind) and Section Sidebar for the complete setup.


Trees and Workspaces

When users click a Tree Item, Umbraco navigates to a Workspace to edit that item. The entityType in your Tree Items must match the meta.entityType in your Workspace Manifest.

See Trees & Workspaces for setup details and troubleshooting.


Further Reading

Last updated

Was this helpful?