Navigation Menu
Site navigation: links and triggers in a nav, each trigger revealing a panel of links on click, hover or the keyboard; disclosure buttons and real links, not an ARIA menu.
Angular: available Vue: available React: available React Native: not available yet
Usage
<div class="demo-row" style="align-items: flex-start; min-height: 16rem">
<nav soneNavigationMenu aria-label="Product">
<ul soneNavigationMenuList>
<li soneNavigationMenuItem value="start">
<button soneNavigationMenuTrigger>Getting started</button>
<div soneNavigationMenuContent>
<a soneNavigationMenuLink href="#introduction">
Introduction
<span class="text-hint">Tokens, skins and the components.</span>
</a>
<a soneNavigationMenuLink href="#installation">
Installation
<span class="text-hint">Add SurfaceOne to an app.</span>
</a>
<a soneNavigationMenuLink href="#theming">
Theming
<span class="text-hint">Skins, accents and dark mode.</span>
</a>
</div>
</li>
<li soneNavigationMenuItem value="components">
<button soneNavigationMenuTrigger>Components</button>
<div soneNavigationMenuContent>
<a soneNavigationMenuLink href="#dialog">Dialog</a>
<a soneNavigationMenuLink href="#hover-card">Hover Card</a>
<a soneNavigationMenuLink href="#menubar">Menubar</a>
</div>
</li>
<li soneNavigationMenuItem>
<a soneNavigationMenuLink href="#docs" active>Docs</a>
</li>
</ul>
</nav>
</div>Import
import {
SoneNavigationMenuContentDirective,
SoneNavigationMenuDirective,
SoneNavigationMenuItemDirective,
SoneNavigationMenuLinkDirective,
SoneNavigationMenuListDirective,
SoneNavigationMenuTriggerDirective,
} from "@surface-one/angular/navigation-menu";API reference
SoneNavigationMenuContentDirectiveDirective
`[soneNavigationMenuContent]` — the panel of links its trigger reveals, under the item. `hidden` while closed (still in the page); Escape closes it and focuses the trigger, and following one of its links closes it.
SoneNavigationMenuDirectiveDirective
`nav[soneNavigationMenu]` — site navigation (shadcn/ui and Radix NavigationMenu, spartan/ui Navigation Menu): a list of links and disclosure triggers, each trigger revealing a content panel of links under it. It is navigation, not an ARIA menu: the triggers are buttons with `aria-expanded` / `aria-controls`, the links are links (`active` sets `aria-current="page"`), and Tab moves through them in order. One content is open at a time — `[(value)]` names it; it opens on click, on ArrowDown (on its first link) and on hover after `openDelay`, and closes `closeDelay` after the pointer leaves, on Escape, on a click outside and when focus leaves the menu. ArrowLeft / ArrowRight, Home and End move between the top-level items. Name it with `aria-label`. The contents stay in the page while closed (`hidden`), so the links are prerendered for search engines.
| Name | Type | Default |
|---|---|---|
valuetwo-wayThe open item's `value`, or `null` — `[(value)]`. | string | null | null |
openDelayms from resting the pointer on a trigger to opening (when nothing is open yet). | number | 200 |
closeDelayms from leaving an item to closing. | number | 150 |
SoneNavigationMenuItemDirectiveDirective
`[soneNavigationMenuItem]` — one `<li>`: a link, or a trigger and its content. The pointer resting anywhere on it (trigger or open content) keeps it open.
| Name | Type | Default |
|---|---|---|
valueWhat `[(value)]` of the menu says when this item is open (generated when left out). | string | null | null |
SoneNavigationMenuLinkDirectiveDirective
`[soneNavigationMenuLink]` — a link, at the top level or in a content. `active` marks the current page (`aria-current="page"`, `data-active`).
| Name | Type | Default |
|---|---|---|
active | boolean | false |
SoneNavigationMenuListDirectiveDirective
`[soneNavigationMenuList]` — the `<ul>` of top-level items; arrow keys move along it.
SoneNavigationMenuTriggerDirectiveDirective
`[soneNavigationMenuTrigger]` — the button that reveals its item's content (`aria-expanded`, `aria-controls`), with a chevron drawn by CSS.