Skip to main content
cngx-src documentation

CngxMenuHost

Interface

projects/common/interactive/menu/menu-host.token.ts

Referenced by#

Import#

import { CngxMenuHost } from '@cngx/common/interactive'

Description#

Structural contract a CngxMenu (or a future menu-bar / nested menu host) exposes to composers. Triggers and submenu directives depend on this interface rather than on the concrete CngxMenu class so the coupling stays substitutable.

Index#

Instance Properties#

Methods#

focus#void

Move DOM focus to the menu container element. Triggers that need to transfer focus into the menu after open call this. Consumers must ensure the host element carries a non-negative tabindex; see CngxMenu.focus().

registerSubmenuItem#void
registerSubmenuItem(item: CngxMenuSubmenuLike)

Register a submenu companion with this menu so ArrowRight / ArrowLeft focus-stack routing can discover it. Returns a deregister callback the companion invokes on destroy. Preferred over a content query because DI registration crosses the component view boundaries that contentChildren cannot see (a [cngxMenuItemSubmenu] declared inside a wrapper component's own template is invisible to the surrounding menu's content query, but its element injector still resolves CNGX_MENU_HOST).