Components/CommandPalette
Universal Component

CommandPalette

Global command/search palette for quick actions.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

CommandPalette

A global command palette for quick actions and search.

Basic Usage

Demo will load when visible.
<script setup lang="ts">
import { ref } from 'vue'

const open = ref(false)
const selected = ref('')

const commands = [
  { id: 'open', title: 'Open File', description: 'Quickly open a file', shortcut: 'Cmd/Ctrl+O' },
  { id: 'search', title: 'Global Search', description: 'Search across content', shortcut: 'Cmd/Ctrl+K' },
  { id: 'settings', title: 'Settings', description: 'Open preferences', shortcut: 'Cmd/Ctrl+,' },
]

function onSelect(command: { title: string }) {
  selected.value = command.title
}
</script>

<template>
  <TxButton variant="primary" @click="open = true">
    Open command palette
  </TxButton>
  <TxCommandPalette v-model="open" :commands="commands" @select="onSelect" />
</template>

API

TxCommandPalette Props

NameTypeDefaultDescription
modelValueboolean-Visibility state
commandsCommandPaletteItem[][]Command list
placeholderstring'Search commands'Search placeholder
emptyTextstring'No commands found'Empty text
maxHeightnumber320Max list height
autoFocusbooleantrueAuto focus input
closeOnSelectbooleantrueClose after select

CommandPaletteItem

FieldTypeDescription
idstringUnique id
titlestringTitle
descriptionstringDescription
keywordsstring[]Keywords
iconTxIconSource | stringIcon
shortcutstringShortcut
disabledbooleanDisabled state

Events

EventPayloadDescription
update:modelValue(value)Visibility state
select(item)Select command
open-Opened
close-Closed
update:query(value)Search input update