Skip to content

Command

A command palette (⌘K / Ctrl+K) — search filtering, keyboard selection and Enter to execute. open is controlled: it can be set externally, and the global ⌘K shortcut or Esc closes it (closing fires oas-select / removes open).

Basic usage

Basic usage (open with ⌘K / Ctrl+K)

Press ⌘K / Ctrl+K to open the command palette, or control open externally

Controlled open

The open attribute is externally controlled: an external button sets open to open the palette; it closes via Esc / backdrop click / selecting a command (the component removes open; for controlled closing, the host decides whether to reopen after listening to oas-select).

When open, the backdrop covers the full screen, so no external "close" button is provided — use Esc / click the backdrop / select a command to close.

Externally controlled open

Open command paletteopen: falseNothing selected

Groups and empty state

Group titles render from the group field; when nothing matches, an "no matching commands" empty state is shown.

Groups and empty state

Open (try searching "deploy" and "xyz")Nothing selected

API

Attributes

AttributeDescriptionTypeDefault
itemsCommand items JSONstring[]
openWhether open (controlled; auto-removed after selection / Esc)boolean

Events

EventDescription
oas-selectA command was executed, detail: { value }

CommandItem fields:

FieldDescriptionType
labelDisplay textstring
valueSelected value (oas-select detail.value)string
keywordsSearch keywords (optional), matched in addition to the labelstring[]
groupGroup name (optional); same-group items render a group titlestring
disabledDisables the item (not selectable via Enter/click, skipped by arrow keys)boolean

Keyboard: / move the highlight (skipping disabled items), Enter executes and closes, Esc closes, Tab cycles between the search input and the options (focus trap); on open the search input is focused, and on close focus returns to the source element. The global ⌘K / Ctrl+K shortcut toggles it.