Skip to content

Components

CommandPalette

The root component. Renders a modal overlay with a search input, result list, and optional slots. Teleports to <body> by default.

Props

PropTypeDefaultDescription
namestringTarget a specific named palette instance (default singleton when omitted)
placeholderstring'Search commands…'Input placeholder text
maxResultsnumber10Maximum number of results shown
emptyTextstring'No commands found.'Text shown when search returns nothing
loadingTextstring'Loading…'Text shown while async groups are fetching
teleportTostring'body'CSS selector for the <Teleport> target
theme'default' | 'compact''default'Compact uses a narrower, shorter dialog
animationDurationnumber150Fade transition duration in ms
labelsPartial<PaletteLabels>Override built-in UI strings (i18n) — see Localization
groupRecentbooleanfalseCluster recent commands by their group with sub-headers
modesPaletteMode[]Prefix-activated search scopes (see Modes / scopes)
selectablebooleanfalseMulti-select mode (see Multi-select)
previewbooleanfalseShow a preview pane for the active command (see Preview pane)
previewHotkeystring[]['$mod', 'i']Key combo to toggle the preview pane ([] to disable)

Emits

EventPayloadDescription
submit-selectionCommand[]Emitted on $mod+Enter in multi-select mode

Slots

SlotScopeDescription
#trigger{ open, toggle }Custom element that opens the palette
#headerContent inserted above the search input
#input{ query, onInput }Replace the default <input> entirely
#item{ command, active, matches, parents, matchedText }Replace the entire result row (parents = breadcrumb context; matchedText = matching keyword/alias)
#group-header{ group }Replace the group label row
#empty{ query }Shown when the query returns no results
#actions{ command, run, activeIndex, close }Replace the secondary-actions menu
#preview{ command }Preview pane content for the active command (requires preview prop)
#footerContent below the result list

Custom #item slot

vue
<CommandPalette>
  <template #item="{ command, active, matches }">
    <div :class="['my-item', { 'my-item--active': active }]">
      <span v-if="command.icon" class="my-item__icon">{{ command.icon }}</span>

      <span class="my-item__body">
        <component :is="highlightMatches(command.label, matches)" />
        <span v-if="command.description" class="my-item__desc">
          {{ command.description }}
        </span>
      </span>

      <span v-if="command.shortcut?.length" class="my-item__shortcut">
        <kbd v-for="k in command.shortcut" :key="k">{{ k }}</kbd>
      </span>

      <span v-if="command.subCommands?.length">›</span>
    </div>
  </template>
</CommandPalette>
vue
<CommandPalette>
  <template #footer>
    <div class="my-footer">
      <span><kbd>↑↓</kbd> navigate</span>
      <span><kbd>↵</kbd> select</span>
      <span><kbd>Esc</kbd> close</span>
    </div>
  </template>
</CommandPalette>

Programmatic trigger via #trigger slot

vue
<CommandPalette>
  <template #trigger="{ toggle }">
    <button @click="toggle">Open palette</button>
  </template>
</CommandPalette>

CommandItem

Renders a single command row with icon, label (with match highlighting), description, shortcut badge, loading spinner, and disabled state. Used internally; also available for custom layouts.

Props

PropTypeDescription
commandCommandThe command to render
activebooleanWhether this row is keyboard-selected
matchesArray<[number, number]>Highlight ranges from the fuzzy search engine
itemIdstringid attribute for ARIA aria-activedescendant
loadingCommandIdstring | nullID of the currently executing command; shows spinner

Emits

EventDescription
executeUser clicked or pressed Enter on this item
activateUser hovered over this item

CommandGroup

Renders a group header followed by its CommandItem rows. Passes all #item, #item-icon, and #item-shortcut slots through to each child.

Props

PropTypeDescription
groupCommandGroupGroup metadata (id, label, priority)
itemsSearchResult[]Filtered results for this group
activeIndexnumberGlobal active index for highlight tracking
globalOffsetnumberIndex offset within the flat result list
loadingCommandIdstring | nullForwarded to each CommandItem