CngxMenu
projects/common/interactive/menu/menu.directive.ts
Import#
import { CngxMenu } from '@cngx/common/interactive'
Description#
Navigable menu container with WAI-ARIA role="menu" semantics.
Uses CngxActiveDescendant as a hostDirective so items rendered with
CngxMenuItem (or its sub-roles) are tracked automatically. No selection
state - menus fire actions through the itemActivated output.
Metadata#
Host#
Providers#
CNGX_MENU_HOST- useExisting
CngxMenu
Dependencies#
CngxActiveDescendantinject()selfhostadUnderlying CngxActiveDescendant - exposed for trigger composition.
Relationships
Index#
Inputs#
Instance Properties#
unknownEmits the activated item's value on Enter/Space/click.
outputFromObservable(
outputToObservable(this.ad.activated).pipe(takeUntilDestroyed()),
)Methods#
Move DOM focus to the menu container so its host
CngxActiveDescendant receives keyboard input. Consumers (notably
CngxContextMenuTrigger) call this after open to transfer focus
from the trigger zone into the menu. The host element MUST carry a
non-negative tabindex for focus to land - the menu's stories use
tabindex="0" and consumers should mirror that.
preventScroll: true keeps the popover anchored when focusing into
a menu that lives outside the visual viewport edge.
HostBindings#
| Binding | Expression |
|---|---|
[attr.aria-label] | label() |