Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

On a site

Put it in the header beside the logo, and mark the visitor's page as current so they know where they are.

A product site header
Show code
<app-navigation-menu>
    <app-navigation-menu-item key="products" label="Products">
        <app-navigation-menu-link label="Analytics" description="Dashboards for every team" href="/analytics" icon="chart" />
        <app-navigation-menu-link label="Billing" description="Invoices, plans and payments" href="/billing" icon="credit-card" />
        <app-navigation-menu-link label="Support" description="A shared inbox for customers" href="/support" icon="mail" />
    </app-navigation-menu-item>
    <app-navigation-menu-item label="Pricing" href="/pricing" current="true" />
</app-navigation-menu>

Entry shapes

Use a plain link for one destination, and a panel for a group of links with descriptions or icons.

Plain links and the current page
link entry
current page
Show code
<app-navigation-menu>
    <app-navigation-menu-item label="Docs" href="/docs" />
</app-navigation-menu>
<app-navigation-menu>
    <app-navigation-menu-item label="Pricing" href="/pricing" current="true" />
</app-navigation-menu>
Panels, descriptions and icons
panel of links
descriptions
icons
current link
Show code
<app-navigation-menu>
    <app-navigation-menu-item key="p" label="Products">
        <app-navigation-menu-link label="About us" href="/about" />
    </app-navigation-menu-item>
</app-navigation-menu>
<app-navigation-menu>
    <app-navigation-menu-item key="p" label="Products">
        <app-navigation-menu-link label="Analytics" description="Dashboards for every team" href="/analytics" />
    </app-navigation-menu-item>
</app-navigation-menu>
<app-navigation-menu>
    <app-navigation-menu-item key="p" label="Products">
        <app-navigation-menu-link label="Analytics" href="/analytics" icon="chart" />
    </app-navigation-menu-item>
</app-navigation-menu>
<app-navigation-menu>
    <app-navigation-menu-item key="p" label="Products">
        <app-navigation-menu-link label="Billing" href="/billing" current="true" />
    </app-navigation-menu-item>
</app-navigation-menu>

Every option

Every value of every prop, one cell each.

items: entry shapes

link entry
current page
panel of links
descriptions
icons
current link
key: the entry's key, not shown, no visible change

ariaLabel

ariaLabel: names the landmark for screen readers, default Main

linkComponent

linkComponent: React only, a router link; Razor links are plain a

className

class: an extra class on the root, for the page's own styling

Guidance

What to do, and what to avoid.

Use it when

  • A public site or portal header has sections, each with several destinations worth a short description.
  • Some entries are plain links beside the ones with panels.

Reach for something else when

  • A signed-in app's sidebar of destinations. → AppShell
  • One button opens a short list of actions. → AppDropdown

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

React, generated from the controls
<AppNavigationMenu
  items={[
    { key: 'products', label: 'Products', links: [
      { key: 'analytics', label: 'Analytics', description: 'Dashboards for every team', to: '/analytics', icon: 'chart' },
    ] },
    { key: 'pricing', label: 'Pricing', to: '/pricing', current: true },
  ]}
/>
Razor, the same props
<app-navigation-menu>…</app-navigation-menu>

3 props. The 1 most used come first.

Used on most screens 1 props

PropTypeDefaultDescription
aria-labeldefault Main string Main The accessible name of the navigation landmark.

Less common 2 props

PropTypeDefaultDescription
<app-navigation-menu-item>default - child - Razor writes the entries as child elements of the menu, and renders each link as a plain link.
<app-navigation-menu-link>default - child - A link inside an entry with links, rendered as a plain link.

On <app-navigation-menu-item>: label (required), key (the entry's id in the toggle event; its position when omitted), href (the link's URL, for an entry without links) and current. On <app-navigation-menu-link>: label and href (both required), description, icon (a library icon name) and current. A page can follow a panel through the bubbling wui-navigation-menu:toggle event (detail.key, detail.open).

Screen reader

3 notes
  • The entries sit in a navigation landmark named by ariaLabel, and the current page is marked with aria-current page.
  • A panel button reports aria-expanded and names its panel through aria-controls; a panel opens on click, Enter, Space or Down, never on hover alone.
  • Escape closes the panel and returns focus to its button, and Left and Right move along the entries.