An item in a Menu.
API
class MenuItem<V> {
readonly element: HTMLElement;
readonly @Input() id: InputSignal<any>;
readonly @Input() value: InputSignal<V>;
readonly @Input() disabled: InputSignal<boolean>;
readonly @Input() @Output('searchTermChange') searchTerm: ModelSignal<string>;
readonly parent: Menu<V> | MenuBar<V> | null;
readonly @Input() submenu: InputSignal<Menu<V> | undefined>;
readonly active: Signal<any>;
readonly expanded: Signal<any>;
readonly hasPopup: Signal<any>;
open(): void;
close(): void;
}
element
HTMLElementA reference to the host element.
id
InputSignal<any>The unique ID of the menu item.
value
InputSignal<V>The value of the menu item, used as the default aria-label
disabled
InputSignal<boolean>Whether the menu item is disabled.
searchTerm
ModelSignal<string>The search term associated with the menu item.
active
Signal<any>Whether the menu item is active.
expanded
Signal<any>Whether the menu is expanded.
hasPopup
Signal<any>Whether the menu item has a popup.
open
voidOpens the submenu focusing on the first menu item.
@returns
void
close
voidCloses the submenu.
@returns
void
Description
An item in a Menu.
ngMenuItem directives can be used in ngMenu and ngMenuBar to represent a choice or action a user can take. They can also act as triggers for sub-menus.
<div ngMenu (itemSelected)="doAction()"> <div ngMenuItem >Action Item</div> <div ngMenuItem [submenu]="anotherMenu">Submenu Trigger</div> </div>