# CommandPalette

> 搜索并执行工作空间命令，输入、高亮和业务结果分别管理。

网页来源：/components/command-palette

版本：@quirekit/ui 0.3.1；源码修订：d79a6b48d00e+worktree。此文档对应当前源码构建，接入方式以开始使用为准。

接入前置：[开始使用](/raw/components/getting-started.md)（Vue、样式、主题与图标 Provider）。

## 搜索与执行

查询匹配名称、说明和 keywords，不区分大小写，多个词都需匹配。保持宿主组与命令顺序；不自动猜测拼音或错别字。方向键高亮不会执行；Enter 或点击有效结果触发 select，查询保持原样。同一条命令可以再次执行。

### 示例：command-palette/basic

文件：`basic.vue`

```vue
<script setup lang="ts">
import { ref } from 'vue';
import { QuireCommandPalette } from '@quirekit/ui/vue';
import type { QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const count = ref(0);
const selected = ref('尚未执行');
</script>
<template><div data-command-basic class="grid gap-2 p-qk-surface"><QuireCommandPalette label="搜索工作空间命令" :groups="groups" @select="selected = $event.label; count++" /><output class="text-qk-helper leading-qk-helper text-qk-text-secondary">执行 {{ count }} 次 · {{ selected }}</output></div></template>
```

## 分组、图标与快捷键

groups 与 items 使用稳定唯一 key。leading/trailing 只放图标、Kbd、Tag 等静态内容；不要在结果行里嵌套其他按钮。keys 仅显示快捷键，不自动注册。

### 示例：command-palette/groups

文件：`groups.vue`

```vue
<script setup lang="ts">
import { ref } from 'vue';
import { QuireCommandPalette, QuireIcon, QuireTag } from '@quirekit/ui/vue';
import type { QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const selected = ref('尚未选择');
</script>
<template><div data-command-groups class="grid gap-2 p-qk-surface"><QuireCommandPalette label="分组命令" :groups="groups" @select="selected = $event.label"><template #leading><QuireIcon name="search" :size="16" /></template><template #trailing="{item}"><QuireTag v-if="item.key === 'template'" size="xs">推荐</QuireTag></template><template #footer><p class="m-0 text-qk-helper text-qk-text-secondary">图标与标签只作说明，命令行内不嵌套操作。</p></template></QuireCommandPalette><output>{{ selected }}</output></div></template>
```

## 受控查询

`v-model:search` 支持宿主同步查询。未绑定时使用 defaultSearch 初始化；过滤和状态变化保留同一个输入节点。

### 示例：command-palette/controlled

文件：`controlled.vue`

```vue
<script setup lang="ts">
import { ref } from 'vue';
import { QuireCommandPalette, QuireButton } from '@quirekit/ui/vue';
import type { QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const search = ref('');
</script>
<template><div data-command-controlled class="grid gap-2 p-qk-surface"><div class="flex flex-wrap gap-2"><QuireButton @click="search = '设置'">查找设置</QuireButton><QuireButton @click="search = ''">重置查询</QuireButton></div><QuireCommandPalette v-model:search="search" label="受控命令搜索" :groups="groups" /><output>当前查询：{{ search || '空' }}</output></div></template>
```

## 禁用与空数据

disabled 禁用整项搜索；item.disabled 保留命令说明，但不允许执行。disabledReason 明确解释不可用原因。无结果提供已有 EmptyState，不将空白误当作加载。

### 示例：command-palette/states

文件：`states.vue`

```vue
<script setup lang="ts">
import { computed, ref } from 'vue';
import { QuireCommandPalette, QuireSwitch } from '@quirekit/ui/vue';
import type { QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const disabled = ref(false), unavailable = ref(false), empty = ref(false);
const items = computed(() => empty.value ? [] : groups.map(group => ({ ...group, items: group.items.map(item => ({ ...item, disabled: unavailable.value || item.disabled })) })));
</script>
<template><div data-command-states class="grid gap-2 p-qk-surface"><div class="flex flex-wrap gap-qk-group"><QuireSwitch v-model:checked="disabled" label="禁用搜索" /><QuireSwitch v-model:checked="unavailable" label="全部命令不可用" /><QuireSwitch v-model:checked="empty" label="清空命令数据" /></div><QuireCommandPalette label="状态命令搜索" :groups="items" :disabled="disabled" /></div></template>
```

## 远程搜索与恢复

`filter="none"` 由宿主提供结果，loading 禁止执行旧结果。errorText 替换结果并提供 retry；查询不会被清空。示例模拟延迟、请求代次与取消：较旧的回复不得覆盖最新输入。

### 示例：command-palette/remote

文件：`remote.vue`

```vue
<script setup lang="ts">
import { onUnmounted, ref, watch } from 'vue';
import { QuireCommandPalette, QuireSwitch, type QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const search = ref(''), fail = ref(false), loading = ref(false), error = ref('');
const results = ref<readonly QuireKitCommandPaletteGroup[]>(groups);
let generation = 0;
let timer: ReturnType<typeof setTimeout> | undefined;
/** Simulates host requests; stale replies never replace newer query results. */
function load(): void {
  const request = ++generation;
  const term = search.value;
  loading.value = true; error.value = '';
  clearTimeout(timer);
  timer = setTimeout(() => {
    if (request !== generation) return;
    loading.value = false;
    if (fail.value) { error.value = '连接失败，查询已保留。请恢复连接后重试。'; return; }
    results.value = groups.map(group => ({ ...group, items: group.items.filter(item => item.label.includes(term)) })).filter(group => group.items.length);
  }, term.length === 1 ? 700 : 200);
}
watch(search, load);
onUnmounted(() => { generation++; clearTimeout(timer); });
</script>
<template><div data-command-remote class="grid gap-2 p-qk-surface"><QuireSwitch v-model:checked="fail" label="模拟连接失败" /><QuireCommandPalette v-model:search="search" label="远程命令搜索" :groups="results" filter="none" :loading="loading" :error-text="error" @retry="load" /><output>查询：{{ search || '空' }}</output></div></template>
```

## 对话框与宿主快捷键

QuireCommandPaletteDialog 组合现有 Dialog，打开聚焦输入，Escape 一次关闭并返回触发器。Cmd/Ctrl+K 由本示例宿主注册与卸载；组件本身不接管全局快捷键。关闭后查询保留。

### 示例：command-palette/dialog

文件：`dialog.vue`

```vue
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue';
import { QuireCommandPaletteDialog, QuireButton, QuireKbd } from '@quirekit/ui/vue';
import type { QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const open = ref(false), search = ref(''), count = ref(0);
/** @param event - Host shortcut, registered only while this example is mounted. */
function shortcut(event: KeyboardEvent): void {
  if (!(event.metaKey || event.ctrlKey) || event.key.toLowerCase() !== 'k' || event.isComposing || event.keyCode === 229 || event.repeat) return;
  event.preventDefault(); open.value = !open.value;
}
onMounted(() => window.addEventListener('keydown', shortcut));
onUnmounted(() => window.removeEventListener('keydown', shortcut));
</script>
<template><div data-command-dialog class="grid gap-2 p-qk-surface"><QuireCommandPaletteDialog v-model:open="open" v-model:search="search" title="工作空间命令" label="搜索对话框命令" :groups="groups" @select="count++; open = false"><template #trigger><QuireButton>打开命令面板</QuireButton></template><template #footer><span class="text-qk-text-secondary">方向键选择 · Enter 执行 · Esc 关闭</span></template></QuireCommandPaletteDialog><p class="m-0">宿主快捷键 <QuireKbd :keys="['Ctrl / ⌘', 'K']" />；关闭后保留查询。</p><output>完成 {{ count }} 次 · 查询：{{ search || '空' }}</output></div></template>
```

## 异步执行与焦点交接

select 只表示请求执行，不代表成功，也不自动关闭。busy 阻止重复激活，允许取消和保留查询；失败继续显示恢复说明。成功后宿主关闭并通过 finalFocusEl 将焦点交给结果区域。请求与权限始终由业务层处理。

### 示例：command-palette/execution

文件：`execution.vue`

```vue
<script setup lang="ts">
import { nextTick, onUnmounted, ref } from 'vue';
import { QuireCommandPaletteDialog, QuireButton, QuireSwitch, type QuireKitCommandPaletteItem } from '@quirekit/ui/vue';
import type { QuireKitCommandPaletteGroup } from '@quirekit/ui/vue';

const groups: readonly QuireKitCommandPaletteGroup[] = [
  { key: 'documents', label: '文档', items: [
    { key: 'create', label: '新建文档', description: '从空白页面开始。', keywords: ['create', 'new'], keys: ['⌘', 'N'] },
    { key: 'template', label: '从模板创建', keywords: ['template'] },
    { key: 'export', label: '导出文件', disabled: true, disabledReason: '请先打开一份文档。' }
  ] },
  { key: 'view', label: '工作空间', items: [
    { key: 'search', label: '搜索文档', keywords: ['find'] },
    { key: 'settings', label: '打开设置', keywords: ['preferences'] }
  ] }
];
const open = ref(false), busy = ref(false), fail = ref(true), message = ref('等待执行');
const destination = ref<HTMLOutputElement>();
let timer: ReturnType<typeof setTimeout> | undefined;
/** @param item - Selected command; this host owns asynchronous execution. */
function execute(item: QuireKitCommandPaletteItem): void {
  if (busy.value) return;
  busy.value = true; message.value = `正在执行：${item.label}`;
  timer = setTimeout(async () => {
    busy.value = false;
    if (fail.value) { message.value = '执行失败，搜索仍然保留，可以再次选择重试。'; return; }
    message.value = `已完成：${item.label}`;
    open.value = false;
    await nextTick();
  }, 450);
}
onUnmounted(() => clearTimeout(timer));
</script>
<template><div data-command-execution class="grid gap-2 p-qk-surface"><QuireSwitch v-model:checked="fail" label="模拟执行失败" /><QuireCommandPaletteDialog v-model:open="open" title="执行工作空间命令" label="查找待执行命令" :groups="groups" :busy="busy" :final-focus-el="() => destination ?? null" @select="execute"><template #trigger><QuireButton>打开执行面板</QuireButton></template><template #footer><output>{{ message }}</output></template></QuireCommandPaletteDialog><output ref="destination" tabindex="-1">{{ message }}</output></div></template>
```

## 控件密度

`size` 调整搜索输入，默认 `sm`；`density="compact|regular"` 独立调整结果行，默认 `regular`。多行说明自然增高，结果区域在可用高度内滚动。

### 示例：command-palette/sizes

文件：`sizes.vue`

```vue
<script setup lang="ts">
import { QuireCommandPalette, QuireButton } from '@quirekit/ui/vue';
const sizes = ['xs','sm','md','lg','xl'] as const;
const groups = [{key:'tools',label:'操作',items:[{key:'save',label:'保存文档'}]}];
</script>
<template><div data-command-sizes class="grid gap-qk-group p-qk-surface"><div v-for="size in sizes" :key="size" class="grid gap-2"><h3 class="m-0">{{ size }}</h3><QuireButton :size="size" class="justify-self-start">{{ size }} 保存</QuireButton><QuireCommandPalette :label="`${size} 命令搜索`" :size="size" :density="size === 'xs' ? 'compact' : 'regular'" :groups="groups" /></div></div></template>
```

## 长名称与阅读方向

长内容完整换行，快捷键保留独立留白；窄屏中快捷键另起一行，避免挤压命令名称或撑破键帽。结果区域内部滚动，键盘高亮始终滚入可见区域。RTL 由 Ark LocaleProvider 与宿主方向共同控制。高亮使用语义软色，键盘焦点留在输入。

### 示例：command-palette/long-content

文件：`long-content.vue`

```vue
<script setup lang="ts">
import { ref } from 'vue';
import { LocaleProvider } from '@ark-ui/vue/locale';
import { QuireCommandPalette, QuireSwitch } from '@quirekit/ui/vue';
const rtl = ref(false);
const groups = [{key:'long',label:'跨团队工作空间操作',items:[{key:'long',label:'VeryLongCommandNameWithoutSpacesForNarrowViewportReview',description:'保留完整名称与说明，让使用较窄窗口的人也能区分相似命令。',keys:['Ctrl','Shift','Enter']},...Array.from({length:18},(_,index)=>({key:`task-${index}`,label:`协作任务 ${index+1}`}))]}];
</script>
<template><div data-command-long class="grid min-w-0 gap-2 p-qk-surface"><QuireSwitch v-model:checked="rtl" label="从右向左显示命令" /><LocaleProvider :locale="rtl ? 'ar' : 'zh-CN'"><div :dir="rtl ? 'rtl' : 'ltr'"><QuireCommandPalette label="长命令搜索" :groups="groups" /></div></LocaleProvider></div></template>
```

## API

### QuireCommandPalette

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Accessible input name. |
| groups | 是 | — | Host-provided command groups. |
| search | 否 | — | Controlled query text, preserved after selection. |
| defaultSearch | 否 | "" | Initial uncontrolled query. |
| size | 否 | "sm" | Shared input size; result rows have independent density. |
| density | 否 | "regular" | Result density, default regular; does not resize the input. |
| placeholder | 否 | — | Host-specific input hint; defaults to the language pack. |
| filter | 否 | "local" | Local token matching, or host-filtered results. |
| loading | 否 | false | Pending results; stale commands cannot activate. |
| busy | 否 | false | Pending execution; leaves search and cancellation available. |
| disabled | 否 | false | Disables the complete search task. |
| errorText | 否 | "" | Host request failure; replaces results until recovered. |
| autoFocus | 否 | false | Automatically focuses the input when mounted. |

**label**

```ts
string
```

**groups**

```ts
readonly QuireKitCommandPaletteGroup[]
```

```ts
readonly ({
  /** Stable group identity. */
  key: string;
  /** Accessible and visible group heading. */
  label: string;
  /** Ordered commands, including unavailable entries. */
  items: readonly ({
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: undefined | string;
    /** Additional terms searched without displaying them. */
    keywords?: undefined | readonly (string)[];
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  })[];
})[]
```

**search**

```ts
string | undefined
```

```ts
undefined | string
```

**defaultSearch**

```ts
string | undefined
```

```ts
undefined | string
```

**size**

```ts
QuireKitControlSize | undefined
```

```ts
undefined | "sm" | "md" | "xs" | "lg" | "xl"
```

**density**

```ts
QuireKitListDensity | undefined
```

```ts
undefined | "compact" | "regular"
```

**placeholder**

```ts
string | undefined
```

```ts
undefined | string
```

**filter**

```ts
"local" | "none" | undefined
```

```ts
undefined | "local" | "none"
```

**loading**

```ts
boolean | undefined
```

**busy**

```ts
boolean | undefined
```

**disabled**

```ts
boolean | undefined
```

**errorText**

```ts
string | undefined
```

```ts
undefined | string
```

**autoFocus**

```ts
boolean | undefined
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| escape | 否 | — |  |
| retry | 否 | — |  |
| update\:search | 否 | — |  |
| select | 否 | — |  |

**escape**

```ts
[event: KeyboardEvent]
```

**retry**

```ts
[]
```

**update:search**

```ts
[search: string]
```

**select**

```ts
[item: QuireKitCommandPaletteItem]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| leading | 否 | — | Static leading icon or avatar. |
| trailing | 否 | — | Static shortcut or supporting badge. |
| footer | 否 | — | Optional explanatory footer or host controls outside the result list. |

**leading**

```ts
CommandPaletteItemSlotProps
```

```ts
{
  /** Original host command. */
  item: {
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: undefined | string;
    /** Additional terms searched without displaying them. */
    keywords?: undefined | readonly (string)[];
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  };
}
```

**trailing**

```ts
CommandPaletteItemSlotProps
```

```ts
{
  /** Original host command. */
  item: {
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: undefined | string;
    /** Additional terms searched without displaying them. */
    keywords?: undefined | readonly (string)[];
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  };
}
```

**footer**

```ts
any
```

#### 公开实例成员

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| focus | 否 | — |  |
| getInputElement | 否 | — |  |

**focus**

```ts
() => void
```

```ts
{ (): void; }
```

**getInputElement**

```ts
() => HTMLInputElement | null
```

```ts
{ (): HTMLInputElement | null; }
```

#### 相关类型

```ts
type QuireKitCommandPaletteGroup = {
  /** Stable group identity. */
  key: string;
  /** Accessible and visible group heading. */
  label: string;
  /** Ordered commands, including unavailable entries. */
  items: readonly ({
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: string | undefined;
    /** Additional terms searched without displaying them. */
    keywords?: readonly string[] | undefined;
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  })[];
};
```

```ts
type QuireKitCommandPaletteItem = {
  /** Globally unique stable identity. */
  key: string;
  /** Readable command name. */
  label: string;
  /** Supporting explanation, never truncated by default. */
  description?: undefined | string;
  /** Additional terms searched without displaying them. */
  keywords?: undefined | readonly (string)[];
  /** Prevents activation while preserving discoverability. */
  disabled?: boolean | undefined;
  /** Readable explanation for unavailable commands. */
  disabledReason?: string | undefined;
  /** Display-only shortcut keys; the host registers shortcuts. */
  keys?: readonly string[] | undefined;
};
```

### QuireCommandPaletteDialog

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| title | 是 | — | Visible Dialog title. |
| label | 是 | — | Accessible input name. |
| groups | 是 | — | Host-provided command groups. |
| open | 否 | — | Controlled modal visibility. |
| defaultOpen | 否 | false | Initial uncontrolled modal visibility. |
| description | 否 | — | Optional Dialog explanation. |
| finalFocusEl | 否 | — | Explicit destination after closing; defaults to the opener. |
| search | 否 | — | Controlled query text, preserved after selection. |
| defaultSearch | 否 | — | Initial uncontrolled query. |
| size | 否 | — | Shared input size; result rows have independent density. |
| density | 否 | — | Result density, default regular; does not resize the input. |
| placeholder | 否 | — | Host-specific input hint; defaults to the language pack. |
| filter | 否 | — | Local token matching, or host-filtered results. |
| loading | 否 | — | Pending results; stale commands cannot activate. |
| busy | 否 | — | Pending execution; leaves search and cancellation available. |
| disabled | 否 | — | Disables the complete search task. |
| errorText | 否 | — | Host request failure; replaces results until recovered. |
| autoFocus | 否 | — | Automatically focuses the input when mounted. |

**title**

```ts
string
```

**label**

```ts
string
```

**groups**

```ts
readonly QuireKitCommandPaletteGroup[]
```

```ts
readonly ({
  /** Stable group identity. */
  key: string;
  /** Accessible and visible group heading. */
  label: string;
  /** Ordered commands, including unavailable entries. */
  items: readonly ({
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: undefined | string;
    /** Additional terms searched without displaying them. */
    keywords?: undefined | readonly (string)[];
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  })[];
})[]
```

**open**

```ts
boolean | undefined
```

**defaultOpen**

```ts
boolean | undefined
```

**description**

```ts
string | undefined
```

```ts
undefined | string
```

**finalFocusEl**

```ts
(() => HTMLElement | null) | undefined
```

```ts
undefined | { (): HTMLElement | null; }
```

**search**

```ts
string | undefined
```

```ts
undefined | string
```

**defaultSearch**

```ts
string | undefined
```

```ts
undefined | string
```

**size**

```ts
QuireKitControlSize | undefined
```

```ts
undefined | "sm" | "md" | "xs" | "lg" | "xl"
```

**density**

```ts
QuireKitListDensity | undefined
```

```ts
undefined | "compact" | "regular"
```

**placeholder**

```ts
string | undefined
```

```ts
undefined | string
```

**filter**

```ts
"local" | "none" | undefined
```

```ts
undefined | "local" | "none"
```

**loading**

```ts
boolean | undefined
```

**busy**

```ts
boolean | undefined
```

**disabled**

```ts
boolean | undefined
```

**errorText**

```ts
string | undefined
```

```ts
undefined | string
```

**autoFocus**

```ts
boolean | undefined
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| retry | 否 | — |  |
| update\:open | 否 | — |  |
| update\:search | 否 | — |  |
| select | 否 | — |  |

**retry**

```ts
[]
```

**update:open**

```ts
[open: boolean]
```

**update:search**

```ts
[search: string]
```

**select**

```ts
[item: QuireKitCommandPaletteItem]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| trigger | 否 | — | Single existing Button receiving Ark trigger behavior. |
| leading | 否 | — | Static leading icon or avatar. |
| trailing | 否 | — | Static shortcut or supporting badge. |
| footer | 否 | — | Optional explanatory footer or host controls outside the result list. |

**trigger**

```ts
any
```

**leading**

```ts
CommandPaletteItemSlotProps
```

```ts
{
  /** Original host command. */
  item: {
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: undefined | string;
    /** Additional terms searched without displaying them. */
    keywords?: undefined | readonly (string)[];
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  };
}
```

**trailing**

```ts
CommandPaletteItemSlotProps
```

```ts
{
  /** Original host command. */
  item: {
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: undefined | string;
    /** Additional terms searched without displaying them. */
    keywords?: undefined | readonly (string)[];
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  };
}
```

**footer**

```ts
any
```

#### 公开实例成员

无。

#### 相关类型

```ts
type QuireKitCommandPaletteGroup = {
  /** Stable group identity. */
  key: string;
  /** Accessible and visible group heading. */
  label: string;
  /** Ordered commands, including unavailable entries. */
  items: readonly ({
    /** Globally unique stable identity. */
    key: string;
    /** Readable command name. */
    label: string;
    /** Supporting explanation, never truncated by default. */
    description?: string | undefined;
    /** Additional terms searched without displaying them. */
    keywords?: readonly string[] | undefined;
    /** Prevents activation while preserving discoverability. */
    disabled?: boolean | undefined;
    /** Readable explanation for unavailable commands. */
    disabledReason?: string | undefined;
    /** Display-only shortcut keys; the host registers shortcuts. */
    keys?: readonly string[] | undefined;
  })[];
};
```

```ts
type QuireKitCommandPaletteItem = {
  /** Globally unique stable identity. */
  key: string;
  /** Readable command name. */
  label: string;
  /** Supporting explanation, never truncated by default. */
  description?: undefined | string;
  /** Additional terms searched without displaying them. */
  keywords?: undefined | readonly (string)[];
  /** Prevents activation while preserving discoverability. */
  disabled?: boolean | undefined;
  /** Readable explanation for unavailable commands. */
  disabledReason?: string | undefined;
  /** Display-only shortcut keys; the host registers shortcuts. */
  keys?: readonly string[] | undefined;
};
```
