Skip to content

Menu Bar for Angular

AngularNavigation

Horizontal application menubar (WAI-ARIA APG Menubar): a role=menubar of role=menuitem buttons with one tab stop (roving tabindex). Items with items open a Menu (same component and engine as Menu: submenus, checkbox and radio items, typeahead, overlay stack); items without open nothing and emit aui-select. While a menu is open, ArrowLeft/ArrowRight and hover move between menus. The popups are Menu popups and need @absoluteui/components/menu/style.css as well.

  • Application menusA horizontal bar of commands and menus with submenus, checkboxes, and radio groups.
  • Full keyboard supportArrow keys move between menus while one is open, and typeahead jumps to items.
  • One select eventEvery chosen command arrives as a single event on the host, wherever it sits.
  • Custom renderingRender items yourself while the bar keeps roles, focus, and keyboard handling.

Behavior, design tokens, and limitations are described on the Menu Bar page; this page covers the Angular API.

import { Component } from '@angular/core';
import type { MenuBarItem, MenuBarSelectDetail } from '@absoluteui/components/menu-bar';
import { AuiMenuBar } from '@absoluteui/angular/menu-bar';
@Component({
selector: 'app-editor-menu',
imports: [AuiMenuBar],
template: `<aui-menu-bar label="Editor" [items]="items" (selected)="onSelect($event)"></aui-menu-bar>`,
})
export class EditorMenuComponent {
readonly items: MenuBarItem[] = [
{ id: 'file', label: 'File', items: [{ id: 'new', label: 'New' }, { id: 'save', label: 'Save' }] },
{ id: 'help', label: 'Help' },
];
onSelect(detail: MenuBarSelectDetail): void {
if (detail.id === 'save') {
// save the document
}
}
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiMenuBar } from '@absoluteui/angular/menu-bar';

Defaults for every instance: provideAbsoluteUIConfig({ components: { menuBar: { ... } } }) (see Configuration).

Class AuiMenuBar; template reference #ref="auiMenuBar".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Input Type Default Description
label string Required. Accessible name of the menubar (aria-label). Must be a non-empty string.
items readonly MenuBarItem[] Required. Non-empty list of menubar items { id, label, icon?, disabled?, items? }. Items with items open a Menu; items without are commands. Ids are unique across the bar and all of its menus.
renderItem MenuRenderItem Custom item content (since 0.9.0); the label stays the accessible name and typeahead text. Nodes are reused per item and released with releaseNode when dropped.
icons Partial<MenuIcons> Icon slot overrides passed to every menu.
closeOnSelect boolean true Menus close after activating a checkbox or radio item. Action items always close the menu.
typeahead boolean true Printable characters move focus to the next bar item (skipping disabled items) or menu item whose label starts with them.
direction Direction 'ltr' Arrow-key mirroring and menu/submenu sides. An inherited dir=rtl on the host also makes the bar RTL.
Output Payload Description
(selected) MenuSelectDetail A command bar item or an enabled menu item was activated. Always dispatched on the host (menu selections are re-dispatched there). checked is the new state for checkbox and radio items. Re-emits aui-select.

Call them through a viewChild query or a template reference.

Method Description
close(): void Close any open menu; focus returns to its menubar item when it was inside the menu.

Customize rendering with AuiItem from @absoluteui/angular/templates.

Pattern: WAI-ARIA APG Menubar with Menu popups (the Menu component and engine); roving tabindex on the bar, real DOM focus on menu items.

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Menu Bar: Accessibility and performance.