Skip to main content
cngx-src documentation

CngxCommandPaletteTrigger

Directivev0.1.0WCAG AA

projects/ui/command-palette/palette/command-palette-trigger.directive.ts

Import#

import { CngxCommandPaletteTrigger } from '@cngx/ui/command-palette'

Description#

Optional explicit trigger for a CngxCommandPalette. Opens the palette on click and advertises the popup relationship to assistive tech: aria-haspopup="dialog" plus aria-expanded derived from the palette's isOpen() host seam, so the trigger communicates the open state without any synced local flag. Pass the palette by template reference - orthogonal composition, no ancestor injection.

<button [cngxCommandPaletteTrigger]="palette">
  Search <kbd>Cmd K</kbd>
</button>
<cngx-command-palette #palette />

Metadata#

Host#

Index#

Methods

Inputs

HostListeners

Inputs#

input()Required

The palette this trigger opens.

default { alias: 'cngxCommandPaletteTrigger' }

Methods#

open#void
Protected

HostBindings#

BindingExpression
[attr.aria-haspopup]"dialog"
[attr.aria-expanded]palette().isOpen()

HostListeners#

EventHandler
(click)click()