Tree Models

Understanding Tree Item and Root models in Umbraco

Trees use two model types to represent data: Tree Item Model for individual nodes and Tree Root Model for the root node. Your Repository returns these models from its methods.

UmbTreeItemModel

The base interface for Tree Items. All Tree Items must include these properties:

interface UmbTreeItemModel {
  unique: string;        // Identifier for selection, navigation, and API calls
  entityType: string;    // Must match Workspace meta.entityType for navigation
  name: string;          // Display name shown in the tree
  hasChildren: boolean;  // Shows expand arrow when true
  isFolder: boolean;     // Visual styling hint
  icon?: string;         // Icon name (e.g., 'icon-document', 'icon-folder')
  parent?: {             // Parent reference for hierarchy and breadcrumbs
    unique: string;      // Parent's identifier
    entityType: string;  // Parent's entity type
  };
}

Extending the Model

Add custom properties by extending the base interface:

import type { UmbTreeItemModel } from '@umbraco-cms/backoffice/tree';

export interface MyTreeItemModel extends UmbTreeItemModel {
  // Add custom properties
  status: 'draft' | 'published';
  lastModified: string;
}

Your repository methods transform API responses into these models when returning data.

UmbTreeRootModel

The root model represents the top-level node of your Tree. It extends UmbTreeItemModel but typically has unique: null:

Defining a Root Model

The root model is returned by requestTreeRoot() in your Tree Repository.

Entity Types

You typically define two entity types - one for the root and one for items:

The entityType values must match the values in your Workspace and Tree Item Manifests. See Trees & Workspaces for how these connect.

Last updated

Was this helpful?