Skip to content

Vizel API / core/src / buildVizelSlashMenuSpecFromCommands

Function: buildVizelSlashMenuSpecFromCommands()

ts
function buildVizelSlashMenuSpecFromCommands(commands, options): VizelMenuSpec<VizelCommandSpec>;

Defined in: packages/core/src/builders/slash-menu.ts:89

Build a VizelMenuSpec for the slash menu from a VizelCommand array.

Filters by surfaces.slashMenu, sorts by priority, applies the query filter, groups by command.group, and derives a VizelCommandSpec for each entry. The active option carries the id the root's aria-activedescendant points at, matching buildVizelMentionMenuSpec. The framework VizelSlashMenuItem component owns the role="option" element; the spec threads the id and the selection flag to that component.

The empty sections array represents the no-items state; the component renders its default VizelSlashMenuEmpty (or a custom renderEmpty).

Parameters

ParameterType
commandsreadonly VizelCommand[]
optionsVizelSlashMenuFromCommandsOptions

Returns

VizelMenuSpec&lt;VizelCommandSpec&gt;

Released under the MIT License.