Import

import-command.ts
import { type NuiCommand, NuiCommandPalette } from '@needless-ui/angular/command';

NuiCommandPalette

A modal dialog with a search field over your commands.

Selector
nui-command-palette
NuiCommandPalette: Properties
NameTypeDefaultDescription
commandsInputNuiCommand[]The commands, as NuiCommand objects.
openTwo-waybooleanfalseWhether the palette is open.
hotkeyInputstring | null'mod+k'The shortcut that opens and closes it from anywhere, or null for none. mod is ⌘ on Apple devices and Ctrl elsewhere.
bindShortcutsInputbooleanfalseAlso runs commands by their own shortcuts, anywhere on the page.
loopInputbooleantrueDown on the last command goes to the first, and up on the first to the last.
filteringInputbooleantrueFilters as you type. Turn it off when a server filters the commands.
loadingInputbooleanfalseShows a loading row while results are on their way.
hintsInputbooleantrueShows the keys to use at the bottom.
virtualInputboolean | 'auto''auto'Renders only the rows in view: always, never, or auto past 200 rows.
labelInputstring'Command palette'Accessible name of the dialog and its search field.
placeholderInputstring'Type a command or search…'Text shown in the empty search field.
runOutputNuiCommandEmits each command that runs.
queryChangeOutputstringEmits the text as it’s typed, for a server search.
showMethod() => voidOpens the palette.
hideMethod() => voidCloses the palette.
toggleMethod() => voidOpens the palette, or closes it.
backMethod() => voidGoes back to the page before.

Every text it shows or announces is an input too, so you can translate it: emptyLabel loadingLabel backLabel closeLabel moveLabel chooseLabel

NuiCommand

One command, or a page of them.

NuiCommand: Properties
NameTypeDefaultDescription
labelPropertystringThe text shown and searched.
descriptionPropertystringSecondary text under the label.
groupPropertystringCommands with the same group are listed under that heading.
keywordsPropertystring[]More words the search matches, such as synonyms.
shortcutPropertystringKeys shown with it, such as mod+shift+p.
disabledPropertybooleanShown, but it can’t run.
childrenPropertyNuiCommand[]Commands one level down: choosing this one opens them as a page.
runProperty() => voidRuns when it’s chosen, once the palette has closed.
idPropertystringFor your own use, such as telling commands apart in (run).