TagHelper
The UmbNav TagHelper provides a clean, declarative syntax for rendering menu items in Razor views. It handles link generation, active states, and HTML attribute output automatically.
Basic Usage
@using Umbraco.Community.UmbNav.Core.Models
@using Umbraco.Community.UmbNav.Core.TagHelpers
@{
var menuItems = Model.Value<IEnumerable<UmbNavItem>>("mainNavigation");
}
<ul>
@foreach (var item in menuItems)
{
<li>
<umbnavitem menu-item="@item"></umbnavitem>
</li>
}
</ul>Output
Attributes Reference
Required Attributes
Attribute
Type
Description
URL Generation
Attribute
Type
Default
Description
Active State
Attribute
Type
Default
Description
Label Items
Attribute
Type
Default
Description
Detailed Examples
Basic Navigation
With Active State
Multi-Level Navigation
Multilingual Sites
Custom Label Tags
Absolute URLs
Understanding Active State
1. Pre-computed Active State
2. Runtime Active Check
Handling Item Types
Link Items (UmbNavItemType.Link)
UmbNavItemType.Link)Content Items (UmbNavItemType.Document)
UmbNavItemType.Document)Text Items (UmbNavItemType.Title)
UmbNavItemType.Title)Complete Example
Accessibility Considerations
CSS Output
Performance Tips
Last updated
Was this helpful?