CngxCommand
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#
unknownConsumer payload the row slot narrows at the use-site. Heterogeneous, hence unknown.
SignalReactive disabled state. A disabled command stays perceivable and communicates its why.
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 key; also the value the default matcher's scope filter compares against.
Optional icon token; the consumer's row template resolves it against its own design system.
Methods#
void | PromiseRuns the command. May be async; the palette does not await the result.