Navigation Menu
Top navigation bar with new NavItem, NavList, NavTrigger, and NavContent subcomponents.
v0.3.0 adds NavList, NavItem, NavTrigger, and NavContent subcomponents for a fully compositional navigation pattern.
What changed from v0.2.x
| v0.2.1 | v0.3.0 |
|---|---|
<NavigationMenuItem Title="..." HasContent="true"> items |
<NavItem><NavTrigger>...</NavTrigger><NavContent>...</NavContent></NavItem> |
| Title string parameter | NavTrigger takes any RenderFragment |
Installation
bash
shellui add navigation-menu nav-item nav-list nav-trigger nav-content
Usage
Basic navigation with dropdowns
Links next to dropdowns
Plain links sit in the NavList beside the NavItem dropdowns.
Header nav bar
A site header with a logo, the menu and actions. It uses container queries, so it adapts to its own width: on a narrow screen the logo text and extra links drop out and the panel becomes one column. NavContent is 14rem wide by default; a class attribute replaces its classes, which is how the wider two-column panel is made, so keep the positioning classes when you set one.
API Reference
<NavigationMenu>
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | NavList |
<NavList>
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | NavItem children |
<NavItem>
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | NavTrigger + NavContent |
ClassName |
string |
"" |
Additional CSS classes |
<NavTrigger>
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Trigger button label |
<NavContent>
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Dropdown panel content |