Import
import { type NuiCommand, NuiCommandPalette } from '@needless-ui/angular/command';NuiCommandPalette
A modal dialog with a search field over your commands.
| Name | Type | Default | Description |
|---|---|---|---|
commandsInput | NuiCommand[] | The commands, as NuiCommand objects. | |
openTwo-way | boolean | false | Whether the palette is open. |
hotkeyInput | string | null | 'mod+k' | The shortcut that opens and closes it from anywhere, or null for none. mod is ⌘ on Apple devices and Ctrl elsewhere. |
bindShortcutsInput | boolean | false | Also runs commands by their own shortcuts, anywhere on the page. |
loopInput | boolean | true | Down on the last command goes to the first, and up on the first to the last. |
filteringInput | boolean | true | Filters as you type. Turn it off when a server filters the commands. |
loadingInput | boolean | false | Shows a loading row while results are on their way. |
hintsInput | boolean | true | Shows the keys to use at the bottom. |
virtualInput | boolean | 'auto' | 'auto' | Renders only the rows in view: always, never, or auto past 200 rows. |
labelInput | string | 'Command palette' | Accessible name of the dialog and its search field. |
placeholderInput | string | 'Type a command or search…' | Text shown in the empty search field. |
runOutput | NuiCommand | Emits each command that runs. | |
queryChangeOutput | string | Emits the text as it’s typed, for a server search. | |
showMethod | () => void | Opens the palette. | |
hideMethod | () => void | Closes the palette. | |
toggleMethod | () => void | Opens the palette, or closes it. | |
backMethod | () => void | Goes 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.
| Name | Type | Default | Description |
|---|---|---|---|
labelProperty | string | The text shown and searched. | |
descriptionProperty | string | Secondary text under the label. | |
groupProperty | string | Commands with the same group are listed under that heading. | |
keywordsProperty | string[] | More words the search matches, such as synonyms. | |
shortcutProperty | string | Keys shown with it, such as mod+shift+p. | |
disabledProperty | boolean | Shown, but it can’t run. | |
childrenProperty | NuiCommand[] | Commands one level down: choosing this one opens them as a page. | |
runProperty | () => void | Runs when it’s chosen, once the palette has closed. | |
idProperty | string | For your own use, such as telling commands apart in (run). |