umbraco-tree-item
Implement tree items in Umbraco backoffice using official docs
What this skill does
# Umbraco Tree Item
## What is it?
Tree Items define how entities are rendered in tree structures throughout the Umbraco backoffice. They control the visual representation and behavior of items in sidebars and navigation trees. Tree items are associated with entity types and can be customized to display additional information, icons, or custom rendering for specific entity types.
## Documentation
Always fetch the latest docs before implementing:
- **Main docs**: https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-types/tree
- **Foundation**: https://docs.umbraco.com/umbraco-cms/customizing/foundation
- **Extension Registry**: https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-registry
## When to Use Custom Tree Item Contexts
Most tree items use `kind: 'default'` and **don't need a custom context**. Only create a custom context for:
- **Custom icon logic** - Dynamic icons based on item state
- **Custom labels or badges** - Additional visual information
- **Special rendering** - Unique behavior for specific entity types
- **Additional item behaviors** - Click handlers, drag-and-drop, etc.
If you just need standard tree items, use `kind: 'default'` without a custom context.
## Related Foundation Skills
- **Tree**: Tree items work within tree structures
- Reference skill: `umbraco-tree`
- **IMPORTANT**: Tree stores are deprecated in Umbraco 14+, see that skill for details
- **Repository Pattern**: When loading tree data
- Reference skill: `umbraco-repository-pattern`
- **Context API**: When accessing tree context
- Reference skill: `umbraco-context-api`
## Workflow
1. **Fetch docs** - Use WebFetch on the URLs above
2. **Ask questions** - What entity types? What custom rendering?
3. **Generate files** - Create manifest + optional element/context
4. **Explain** - Show what was created and how to test
## Minimal Examples
### Basic Manifest (manifests.ts)
```typescript
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'treeItem',
kind: 'default',
alias: 'My.TreeItem',
name: 'My Tree Item',
forEntityTypes: ['my-entity-type'],
},
];
```
### Custom Tree Item with Context
```typescript
import { MY_ENTITY_TYPE, MY_ROOT_ENTITY_TYPE } from '../entity.js';
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'treeItem',
kind: 'default',
alias: 'My.TreeItem.Custom',
name: 'My Custom Tree Item',
forEntityTypes: [MY_ENTITY_TYPE, MY_ROOT_ENTITY_TYPE],
api: () => import('./my-tree-item.context.js'),
},
];
```
### Tree Item Context (my-tree-item.context.ts)
```typescript
import { UmbDefaultTreeItemContext } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbTreeItemModel, UmbTreeRootModel } from '@umbraco-cms/backoffice/tree';
export class MyTreeItemContext extends UmbDefaultTreeItemContext<
UmbTreeItemModel,
UmbTreeRootModel
> {
constructor(host: UmbControllerHost) {
super(host);
}
// Override to customize icon
override async getIcon() {
const item = this.getTreeItem();
if (item?.hasChildren) {
return 'icon-folder';
}
return 'icon-document';
}
// Override to add custom labels/badges
override async getLabel() {
const item = this.getTreeItem();
return item?.name ?? 'Unknown';
}
}
export { MyTreeItemContext as api };
```
### Complete Tree with Tree Item
```typescript
import { MY_ENTITY_TYPE, MY_ROOT_ENTITY_TYPE } from './entity.js';
import { MY_TREE_ALIAS, MY_TREE_REPOSITORY_ALIAS } from './constants.js';
export const manifests: Array<UmbExtensionManifest> = [
// Tree definition
{
type: 'tree',
kind: 'default',
alias: MY_TREE_ALIAS,
name: 'My Tree',
meta: {
repositoryAlias: MY_TREE_REPOSITORY_ALIAS,
},
},
// Tree item for the entities
{
type: 'treeItem',
kind: 'default',
alias: 'My.TreeItem',
name: 'My Tree Item',
forEntityTypes: [MY_ROOT_ENTITY_TYPE, MY_ENTITY_TYPE],
},
];
```
## Interface Reference
```typescript
interface ManifestTreeItem extends ManifestElementAndApi<UmbControllerHostElement, UmbTreeItemContext> {
type: 'treeItem';
forEntityTypes: Array<string>; // Entity types this tree item renders
}
```
## Common Entity Types
Built-in entity types that have tree items:
- `document` - Content nodes
- `document-root` - Content root
- `media` - Media items
- `media-root` - Media root
- `member` - Members
- `data-type` - Data types
- `document-type` - Document types
- `template` - Templates
## Kinds
The `kind: 'default'` uses the standard tree item rendering. Custom kinds can be created for specialized rendering.
## Best Practices
- Use appropriate icons for different entity types
- Consider loading states for async data
- Keep tree items lightweight for performance
- Use entity type constants for type safety
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.