plus-largeExtensibility

UmbNav is designed to be fully extensible. You can customize both the frontend (TypeScript/Lit) and backend (C#) to match your specific requirements.

Extension Architecture

UmbNav follows a layered architecture that allows customization at multiple levels:

┌─────────────────────────────────────────┐
│           Backoffice UI (Lit)           │
│  ┌─────────────────────────────────┐    │
│  │     Extension Registry          │    │  ← Register custom actions, slots, types
│  │  • Toolbar Actions              │    │
│  │  • Item Slots                   │    │
│  │  • Item Types                   │    │
│  └─────────────────────────────────┘    │
│  ┌─────────────────────────────────┐    │
│  │     Component Classes           │    │  ← Subclass for deep customization
│  │  • UmbNavItem                   │    │
│  │  • UmbNavGroup                  │    │
│  │  • UmbNavPropertyEditorUI       │    │
│  └─────────────────────────────────┘    │
└─────────────────────────────────────────┘

┌─────────────────────────────────────────┐
│           Backend (C#)                  │
│  ┌─────────────────────────────────┐    │
│  │     Services                    │    │  ← Override for custom processing
│  │  • UmbNavMenuBuilderService     │    │
│  └─────────────────────────────────┘    │
│  ┌─────────────────────────────────┐    │
│  │     TagHelpers                  │    │  ← Extend for custom rendering
│  │  • UmbnavitemTagHelper          │    │
│  └─────────────────────────────────┘    │
│  ┌─────────────────────────────────┐    │
│  │     Converters                  │    │  ← Override for custom conversion
│  │  • UmbNavValueConverter         │    │
│  └─────────────────────────────────┘    │
└─────────────────────────────────────────┘

Frontend Extensions

Extension Registry

The easiest way to extend UmbNav in the backoffice is through the Extension Registry:

Available Extensions:

Type
Purpose
Documentation

Toolbar Actions

Add buttons to item toolbars

Toolbar Actions

Item Slots

Inject content into items

Item Slots

Item Types

Register custom item types

Custom Item Types

Component Subclassing

For deeper customization, subclass UmbNav components:

See Extending Components for details.

Backend Extensions

Customize how menus are built by extending the service:

See Menu Builder Service for details.

TagHelper

Customize how items render in views:

See TagHelper for details.

Extension Points Summary

Frontend (TypeScript/Lit)

Extension Point
Method
Use Case

Toolbar Actions

registerToolbarAction()

Add action buttons

Item Slots

registerItemSlot()

Add badges, icons, content

Item Types

registerItemType()

New item categories

Component Override

Subclass

Deep customization

Backend (C#)

Extension Point
Method
Use Case

Item Visibility

ShouldIncludeItem()

Custom filtering

Content Resolution

ResolveContent()

Custom content lookup

Image Resolution

ResolveImage()

Custom media handling

Active State

GetCurrentContentKey()

Custom active detection

URL Generation

GetUrl()

Custom URLs

HTML Output

ProcessCustomAttributes()

Custom attributes

When to Use Each Approach

Use Extension Registry When:

  • Adding toolbar buttons

  • Adding visual indicators/badges

  • Non-invasive customizations

  • Quick prototyping

Use Component Subclassing When:

  • Changing core rendering logic

  • Replacing entire sections

  • Building white-label solutions

Use Service Override When:

  • Custom visibility rules

  • Integration with external systems

  • Custom content resolution

  • Analytics/tracking requirements

Use TagHelper Override When:

  • Custom HTML output

  • Adding data attributes

  • Integration with frontend frameworks

  • Custom URL generation

Importing the API

For frontend extensions, import from the API bundle:

Best Practices

1. Preserve Core Functionality

When overriding methods, call the base implementation unless you're intentionally replacing it:

2. Use Unique Aliases

Avoid conflicts by prefixing aliases with your package/project name:

3. Handle Errors Gracefully

Extensions shouldn't break the core functionality:

4. Register in Composers

For C# extensions, use the Umbraco Composer pattern:

5. Test Your Extensions

UmbNav includes testing infrastructure. See Testing for guidance.

Last updated

Was this helpful?