Create

Navigation

Navigation Menu

New
Copy page View as Markdown Open in ChatGPT Open in Claude

A collection of links for navigating websites.

Usage#

app.component.ts
import { WDS_NAVIGATION_MENU } from '@wds/angular/navigation-menu';

Put wds-navigation-menu-item elements in wds-navigation-menu and name it with aria-label. An entry with content shows it in a panel; an entry with href and no content is a link. Lay out the panel content with your own classes (e.g. a grid) and use wds-navigation-menu-link for its links. For commands rather than pages use Menubar.

Examples#

Default#

Panels open on hover after open-delay (200 ms) and switch at once while one is open; a click or Enter opens them too. The panel width comes from its content, here a grid.

Alert Dialog Hover Card Progress Scroll Area Tabs Tooltip

Icons#

An icon in the icon slot of a link, with or without a description.

Analytics Automations Security
Documentation Community Help center

Entries without content are links. active marks the current page (aria-current="page"), disabled an entry that cannot be used.

Active section#

active on an entry with a panel highlights the section; active on a link in the panel marks the current page.

Quick start Theming Forms

Panel alignment#

align="end" lines the panel up with the end of its entry, e.g. for an account menu at the edge of a header.

Acme
Profile Settings Sign out

API References#

wds-navigation-menu#

A collection of links for navigating a website: a row of entries, each either a link or a button that shows a panel of links under it (the disclosure navigation pattern, not an ARIA menu). One panel is open at a time. Panels open on hover after a short delay (and switch almost at once while one is open), on click and with the keyboard; they close when the pointer leaves, on Escape, on a click outside or when focus leaves the entry.

Attributes

AttributeTypeDefaultDescription
open-delay.openDelaynumber200Delay before a panel opens on hover, in ms.
close-delay.closeDelaynumber300Delay before a panel closes after the pointer leaves it, in ms.

Events

EventDescription
wds-changeCustomEvent<WdsNavigationMenuChangeDetail>A panel opens or all panels close.

Methods

MethodDescription
close()Closes the open panel.

Slots

SlotDescription
(default)wds-navigation-menu-item elements.

CSS parts (::part)

PartDescription
listThe row of entries.

wds-navigation-menu-item#

One entry of wds-navigation-menu. With content in the default slot it is a button that shows the content in a panel under it (links, cards); with href and no content it is a plain link.

Attributes

AttributeTypeDefaultDescription
labelstring''Label of the entry.
hrefstring''Makes the entry a link (when it has no panel content).
activebooleanfalseThe entry points to the current page or section (aria-current="page" on a link).
disabledbooleanfalseThe entry cannot be used.
alignWdsNavigationMenuAlign'start'Alignment of the panel along the entry.
openbooleanfalseWhether the panel is open. Set by wds-navigation-menu (hover, click, keyboard).

Slots

SlotDescription
(default)Content of the panel, e.g. wds-navigation-menu-link elements in a grid.
labelLabel of the entry (instead of label), e.g. with an icon.

CSS parts (::part)

PartDescription
triggerThe button (or the <a> of a link entry).
contentThe panel.

CSS custom properties

PropertyDescription
--wds-navigation-menu-content-widthWidth of the panel (default: the width of its content).

A link in a panel of wds-navigation-menu: a title, an optional description under it and an optional icon. Choosing it closes the menu.

Attributes

AttributeTypeDefaultDescription
hrefstring''Address of the link.
descriptionstring''Description under the title.
activebooleanfalseThe link points to the current page (aria-current="page").
targetstring | undefinedWhere to open the link, e.g. _blank.

Slots

SlotDescription
(default)Title of the link.
descriptionDescription under the title (instead of description).
iconAn icon before the text.

CSS parts (::part)

PartDescription
linkThe native <a>.
titleThe title.
descriptionThe description.

Accessibility#

Screen reader#

The menu is a navigation landmark (name it with aria-label) with a list of entries. It follows the disclosure navigation pattern: entries with a panel are buttons with aria-expanded and aria-controls, the links are ordinary links.

active sets aria-current="page" on links. A panel stays in the reading order right after its button, so Tab moves from the button into the open panel.

Hover only previews: every panel also opens with a click, Enter or Space.

Keyboard support#

KeyFunction
TabMoves through the entries and, when a panel is open, into its links. Leaving the entry closes the panel.
EnterSpaceOn an entry with a panel: opens or closes the panel.
↓On an entry with a panel: opens it and focuses its first link. In a panel: the next link.
↑In a panel: the previous link, from the first one back to the entry.
←→On an entry: moves to the previous or next entry, wrapping around.
HomeEndOn an entry: moves to the first or last entry.
EscapeCloses the panel and returns focus to its entry.
Footer