Class NavigationItem
Represents a navigation item in a menu or sidebar.
[ExcludeFromCodeCoverage]
public class NavigationItem
- Inheritance
-
NavigationItem
- Inherited Members
Constructors
NavigationItem()
public NavigationItem()
Properties
Collapsed
Gets or sets whether this item's NavigationItems are collapsed.
public bool Collapsed { get; set; }
Property Value
Remarks
Only relevant when NavigationItems is non-empty. Defaults to true so nested items start collapsed until the user expands the parent.
Hidden
Gets or sets whether this item is excluded from rendering.
public bool Hidden { get; set; }
Property Value
Href
Gets or sets the URL this navigation item links to.
public string? Href { get; set; }
Property Value
Remarks
Left null for a parent item whose only purpose is to group NavigationItems. Also used to determine whether the item is the current page (see IsActive) by comparing it against the current URL.
Icon
Gets or sets the icon rendered alongside the item's Label.
public Icon? Icon { get; set; }
Property Value
- Icon?
Id
Gets or sets the element id for this navigation item.
public string? Id { get; set; }
Property Value
Remarks
Rendered as the id attribute on the item's link (or toggle button, for a parent
item). When not supplied, a parent item falls back to an id derived from the item instance so its
toggle button can still be linked to its collapsible children via aria-controls.
IsActive
Gets or sets whether this item should be marked as the active page.
public bool IsActive { get; set; }
Property Value
Remarks
Takes precedence over the automatic URL-based match against Href, so it can be used to force an item active for routes that don't match Href exactly.
Label
Gets or sets the display text for this navigation item.
public string? Label { get; set; }
Property Value
NavigationItems
Gets or sets the nested navigation items rendered as this item's collapsible children.
public List<NavigationItem> NavigationItems { get; set; }
Property Value
Remarks
A non-empty list makes this a parent item: it renders as a toggle button (rather than a link) that expands or collapses this list instead of navigating anywhere itself.
New
This property needs to be removed, it's currently used for the documentation project.
public bool New { get; set; }
Property Value
Remarks
Renders a "New" badge next to the item's label in TwSidebarItem.
TopNavigation
Gets or sets whether this item belongs in a top navigation bar rather than a sidebar.
public bool TopNavigation { get; set; }
Property Value
Remarks
Not read by any TwBlazor component itself - it's carried through unchanged (e.g. by TwSidebar's search filtering) for consumers who render one shared list of items and need to split it between a top nav and a sidebar themselves.