Skip to main content
cngx-src documentation

CngxCommand

Interface

projects/common/command/command.ts

Import#

import { CngxCommand } from '@cngx/common/command'

Description#

A single registrable command - a labelled action the command palette can surface, rank against a query, and run. Commands carry no rendered chrome; they are pure data plus a run callback, so a consumer registers them against @cngx/common/command without pulling in the UI preset.

The list is heterogeneous by design, so there is no CngxCommand<T> type parameter: a payload rides on data as unknown and the row slot narrows it at the use-site.

Index#

Instance Properties#

data#unknown
ReadonlyOptional

Consumer payload the row slot narrows at the use-site. Heterogeneous, hence unknown.

disabled#Signal
ReadonlyOptional

Reactive disabled state. A disabled command stays perceivable and communicates its why.

disabledReason#string
ReadonlyOptional

Why the command is disabled. The default row wires aria-describedby to a node carrying this reason, gated on disabled() && !!disabledReason (Pillar 2 - a disabled control communicates its why).

group#string
ReadonlyOptional

Group key; also the value the default matcher's scope filter compares against.

ReadonlyOptional

Optional icon token; the consumer's row template resolves it against its own design system.

Readonly

Stable identity. Drives the merge equal and the aria-activedescendant id.

keywords#unknown
ReadonlyOptional

Extra terms the matcher ranks against besides the label.

label#string
Readonly

Human-readable label; the primary target the default matcher ranks against.

Methods#

run#void | Promise

Runs the command. May be async; the palette does not await the result.