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.
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.
import { Component } from '@angular/core';import { WdsNavigationMenuComponent, WdsNavigationMenuItemComponent, WdsNavigationMenuLinkComponent } from '@wds/angular/navigation-menu';@Component({ selector: 'app-navigation-menu-default-demo', imports: [WdsNavigationMenuComponent, WdsNavigationMenuItemComponent, WdsNavigationMenuLinkComponent], template: ` <wds-navigation-menu aria-label="Main"> <wds-navigation-menu-item label="Getting started"> <div class="grid w-[min(500px,90vw)] gap-2 sm:grid-cols-[.75fr_1fr]"> <a href="#" class="row-span-3 flex flex-col justify-end rounded-md bg-linear-to-b from-muted/50 to-muted p-4 no-underline outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50" > <span class="mb-2 text-lg font-medium text-foreground">WDS</span> <span class="text-sm leading-tight text-muted-foreground">Web components with wrappers for Angular and React.</span> </a> <wds-navigation-menu-link href="#" description="Install the packages and load the styles.">Installation</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="Colors, spacing, radius and type as CSS variables.">Tokens</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="Use the components in Angular and React.">Frameworks</wds-navigation-menu-link> </div> </wds-navigation-menu-item> <wds-navigation-menu-item label="Components"> <div class="grid w-[min(600px,90vw)] gap-2 sm:grid-cols-2"> <wds-navigation-menu-link href="#" description="A modal dialog that interrupts the user and expects a response.">Alert Dialog</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="For sighted users to preview content available behind a link.">Hover Card</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="Displays an indicator showing the completion progress of a task.">Progress</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="Augments native scroll functionality for custom styling.">Scroll Area</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="Layered sections of content, displayed one at a time.">Tabs</wds-navigation-menu-link> <wds-navigation-menu-link href="#" description="A popup with information about an element on hover or focus.">Tooltip</wds-navigation-menu-link> </div> </wds-navigation-menu-item> <wds-navigation-menu-item label="Docs" href="#"></wds-navigation-menu-item> </wds-navigation-menu> `,})export class NavigationMenuDefaultDemo {}
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
Attribute
Type
Default
Description
open-delay.openDelay
number
200
Delay before a panel opens on hover, in ms.
close-delay.closeDelay
number
300
Delay before a panel closes after the pointer leaves it, in ms.
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
Attribute
Type
Default
Description
label
string
''
Label of the entry.
href
string
''
Makes the entry a link (when it has no panel content).
active
boolean
false
The entry points to the current page or section (aria-current="page" on a link).
disabled
boolean
false
The entry cannot be used.
align
WdsNavigationMenuAlign
'start'
Alignment of the panel along the entry.
open
boolean
false
Whether the panel is open. Set by wds-navigation-menu (hover, click, keyboard).
Slots
Slot
Description
(default)
Content of the panel, e.g. wds-navigation-menu-link elements in a grid.
label
Label of the entry (instead of label), e.g. with an icon.
CSS parts (::part)
Part
Description
trigger
The button (or the <a> of a link entry).
content
The panel.
CSS custom properties
Property
Description
--wds-navigation-menu-content-width
Width of the panel (default: the width of its content).
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.