kor TürkçeGitHub

CommandPalette

Finds actions by name, section or search keyword.

kor/ui/CommandPaletteSource

When to use

  • Offer a searchable shortcut to actions across the application.

Examples

Open a palette

Loading the example

<k:Button text="Find a command" press=".onOpen">
	<k:dependents>
		<k:CommandPalette id="palette" hotkey="false" placeholder="Search commands" run=".onRun">
			<k:Command key="orders" text="Open orders"/>
		</k:CommandPalette>
	</k:dependents>
</k:Button>

Find warehouse actions

Search for “audit” to find the count. Enable hotkey to use Ctrl+K or Command+K across the page.

Loading the example

<k:Button text="Warehouse commands" press=".onOpen">
	<k:dependents>
		<k:CommandPalette id="palette" hotkey="false" placeholder="Search commands" run=".onRun">
			<k:Command key="count" group="Inventory" text="Start a stock count" keywords="audit recount" icon="boxes"/>
			<k:Command key="receive" group="Inbound" text="Receive a delivery" icon="truck"/>
		</k:CommandPalette>
	</k:dependents>
</k:Button>

Keyboard

↑ ↓
Move between results.
Enter Esc
Run the active command or close the palette.

API

Properties

NameTypeDefaultDescription
hotkeybooleantrueWhether to listen for Ctrl+K or Command+K
placeholderstringSearch placeholder

Aggregations

NameTypeDescription
commandsCommand[]Available commands

Events

NameTypeDescription
runkey: stringA command was selected

Methods

NameDescription
isOpen(): booleanReturns whether the palette is open
open(): voidOpens the palette and focuses search
close(): voidCloses the palette

Command

An entry in the command palette.

Properties

NameTypeDefaultDescription
keystringCommand key
textstringCommand text
hintstringSecondary text
iconstringIcon name
groupstringSection heading
keywordsstringAdditional search terms

Events

NameTypeDescription
pressThe command was selected

Related

ShellButton