Create

Navigation

Menubar

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

A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.

Usage#

app.component.ts
import { WDS_MENUBAR } from '@wds/angular/menubar';

Each menu is a Dropdown: a wds-dropdown with a wds-menubar-trigger in its trigger slot and the usual dropdown items, submenus, checkbox and radio items. Name the bar with aria-label. Importing @wds/core/menubar registers the dropdown elements as well.

Examples#

Default#

Menus with shortcuts, submenus, checkbox and radio items. Once a menu is open, hovering another trigger or pressing ← and → switches menus. Selecting an item fires wds-select, which bubbles to wds-menubar.

File New Tab⌘T New Window⌘N New Incognito Window Share Email link Messages Notes Print…⌘P Edit Undo⌘Z Redo⇧⌘Z Find Search the web Find… Find Next Find Previous Cut Copy Paste View Always Show Bookmarks Bar Always Show Full URLs Reload⌘R Force Reload⇧⌘R Toggle Fullscreen Hide Sidebar Profiles Andy Benoit Luis Edit… Add Profile…

Checkbox and radio items#

Checkbox items report their new state in wds-select (detail.checked); a wds-dropdown-radio-group fires wds-change with the chosen value.

ViewStatus BarMinimapThemeLightDarkSystem

Status Bar: on, Minimap: off, Theme: system

Icons#

An <svg> before the text of an item; variant="destructive" for a dangerous action.

File New File⌘N Open Folder…⌘O Save⌘S Edit Undo⌘Z Redo⇧⌘Z Delete Help Documentation

Disabled#

disabled on a wds-dropdown dims its trigger and keeps the menu closed; the trigger stays focusable so it can be found. disabled on an item skips it.

File Open… Save Export Edit Undo Help Documentation Keyboard Shortcuts

API References#

wds-menubar#

A horizontal bar of menus, as in desktop applications (File, Edit, View…), following the WAI-ARIA menubar pattern. Each menu is a wds-dropdown with a wds-menubar-trigger in its trigger slot and the usual dropdown items: wds-dropdown-item (also checkbox and radio), -label, -separator, -group, -radio-group and submenus. Importing @wds/core/menubar registers them as well. The bar is one stop in the tab order. The arrow keys move between the menus; while a menu is open they open the next or previous one, and hovering another trigger switches to its menu.

Slots

SlotDescription
(default)wds-dropdown elements, one per menu.

CSS parts (::part)

PartDescription
baseThe bar.

wds-menubar-trigger#

The button of one menu in wds-menubar. Put it in the trigger slot of a wds-dropdown; the menubar and the dropdown set its role, focus order and state.

Slots

SlotDescription
(default)Label of the menu, optionally with an <svg> icon.

Accessibility#

Screen reader#

The bar is a menubar (name it with aria-label) and each trigger a menuitem with aria-haspopup="menu" and aria-expanded. The open menu is a menu with menuitem, menuitemcheckbox and menuitemradio items.

The bar is a single stop in the tab order (roving tabindex): Tab moves into the bar on the last used trigger and out of it to the next element on the page.

A disabled menu has aria-disabled="true" on its trigger. Shortcuts in the shortcut slot are only displayed; handle the keys yourself.

Keyboard support#

KeyFunction
TabMoves focus into the bar and out of it; an open menu closes.
←→On a trigger: moves to the previous or next menu, wrapping around. In an open menu: closes it and opens the previous or next one (in a submenu ← closes the submenu, → on a submenu trigger opens it).
EnterSpace↓On a trigger: opens the menu and focuses the first item.
↑On a trigger: opens the menu and focuses the last item.
HomeEndOn a trigger: moves to the first or last menu. In a menu: the first or last item.
EscapeCloses the menu and returns focus to its trigger.
A–ZMoves to the menu or item whose text starts with the typed characters.
Footer