Skip to content
Calm motion: animations on this site only fade, with no movement

Command ​

⌘K palette

A search-and-run palette for apps with many commands: ⌘K to open, type, Enter. It helps people who know what they want. It does not replace visible navigation.

Use it for actions and navigation, not for picking values (that's Combobox). Items carry a group, optional keywords and a shortcut label.

Basic
or press ⌘K
New project⌘N
Open recent…⌘O
Save all⌥⌘S
Toggle sidebar⌘B
Toggle theme
Zoom in⌘+
Go to character…
Go to news

Inline
New project⌘N
Open recent…⌘O
Save all⌥⌘S
Toggle sidebar⌘B
Toggle theme
Zoom in⌘+
Go to character…
Go to news

Recent and scoped

Type @ People, # Tag

Home
Billing
SettingsG S
Ayu Lestari
Budi Santoso
bug
idea

Chose: nothing yet

  • ⌘K / Ctrl+K opens it (hotkey), except inside rich-text editors, where that key already inserts a link.
  • The input is a combobox over the result list: ↑ / ↓ move, Enter runs, Home / End jump. Groups (group) are labeled. "No results" is announced.
  • Recent (recent): while the search is empty the items chosen before come first, newest first, in a "Recent" group (recentLimit, default 5). Items that are gone or disabled are left out. v-model:history is the list of values if you want to keep it. persist="app" saves it in localStorage under that key, read after mount.
  • Scopes (:scopes="[{ key: '@', group: 'People' }]"): the key of a scope, typed first, narrows the search to that group. A chip shows the scope ("People ×"). Backspace on an empty search or a click on the chip leaves the scope. A hint under the box lists the keys. A key typed anywhere else is plain text. The name of the input gains "Only in People", so it is spoken.
  • labels translates "Recent", the chip and the hint.
  • keywords add search terms. filter replaces matching. inline renders it in the page instead of a modal.

Usage ​

ts
import { BlessCommand } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
items*BlessCommandItem[]—
placeholderstring"Type a command…"
labelstring"Search commands"accessible name of the search input
emptyTextstring"No results."
hotkeybooleantruebind ⌘K / Ctrl+K to open
inlineboolean—render inline instead of inside a modal
filter((item: BlessCommandItem, query: string) => boolean)—
scopesBlessCommandScope[]—prefixes that narrow the search to one group: `[{ key: "@", group: "People" }]`
recentboolean—put the items chosen before at the top while the search is empty
recentLimitnumber5
persiststring—keep the history in localStorage under this key (read after mount)
labelsPartial<{ recent: string; scope: (label: string) => string; clearScope: string; scopeHint: (parts: string[]) => string; }>—
openbooleanfalse
historystring[][]values of the items chosen so far, most recent first

Events

NamePayloadDescription
update:open[value: boolean]
select[item: BlessCommandItem]
update:history[value: string[]]

Slots

NameScopeDescription
item{ item: BlessCommandItem; }
footer—

Released under the MIT License. Character names and artwork belong to their owners.