# Toolbar

> 将常用动作、开关、选择器和下拉操作组织成紧凑工具栏。

网页来源：/components/toolbar

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

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

Toolbar 将常用动作、开关、选择器和下拉操作组织成工具栏，适合编辑器命令和紧凑的操作区。

横向工具栏默认在可用宽度内滚动，隐藏系统滚动条。内容放不下时显示两侧箭头，按钮、字段和分组保持原有尺寸；无需额外包一层横向滚动容器。

内容全部放得下时默认水平居中；溢出时从起始侧展示，首尾操作都能通过箭头或键盘到达。使用 `align="start"` 可以保持起始对齐。工具栏中的按钮统一使用内建 Tooltip，文字字段可通过 `QuireToolbarField` 组合相同的提示和紧凑尺寸。

## 数据配置与独立外观

`items` 接收 `QuireKitToolbarEntry[]`，支持 action、toggle、menu、selector、disclosure、split、group、separator 和 custom。每项提供稳定 `value` 与可访问名称 `label`；`icon` 引用图标注册表，`text` 增加可见文字，没有图标时直接显示名称。

`select(value)` 返回动作或子菜单条目的值；`toggle(value, pressed)` 请求更新开关，调用方将新状态写回对应项的 `pressed`。Menu 的 `items` 复用相同菜单数据结构。默认插槽优先于 `items`。复杂控件可通过 `renderers` 注册，配置只引用名称，无需在 Toolbar 模板里逐个写按钮。

工具栏提供三种外观，支持同一套数据、键盘导航和模板组件：

- `variant="elevated"` 是无边框的独立工具栏，使用内边距、圆角和轻阴影建立边界，适合画布操作区或选区旁的快捷工具。它只控制外观，定位由调用方处理。
- `variant="outlined"` 提供与 Icon 示例一致的独立工具栏，使用浅色边界、圆角、小内边距和短分隔线。
- 默认 `variant="plain"` 用于嵌入已有工具栏容器，背景透明，由外层布局提供表面、留白和边界。

### 示例：toolbar/configured

文件：`configured.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import type { QuireKitToolbarEntry } from "@quirekit/ui";
import { QuireIconProvider, QuireToolbar } from "@quirekit/ui/vue";

const bold = ref(false);
const fill = ref(true);
const lastAction = ref("选择工具栏操作");
const items = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "undo", label: "撤销", icon: "undo" },
  { value: "separator", label: "", kind: "separator" },
  { value: "format", label: "文字格式", kind: "group", children: [
    { value: "bold", label: "加粗", icon: "bold", kind: "toggle", pressed: bold.value },
    { value: "color", label: "字体颜色", text: "字体颜色", icon: "textColor", kind: "menu", items: [
      { value: "auto", label: "自动" }, { value: "blue", label: "蓝色" },
      { value: "red", label: "红色" }, { value: "custom", label: "自定义颜色", disabled: true }
    ] },
    { value: "fill", label: "单元格填充", icon: "tableCellFill", kind: "toggle", pressed: fill.value }
  ] },
  { value: "save", label: "保存", icon: "save", disabled: true },
  { value: "accept", label: "接受", text: "接受", icon: "check", kind: "split",
    actionLabel: "接受当前修改", disclosureLabel: "接受选项", items: [
      { value: "accept-all", label: "接受全部修改" }
    ] }
]);
/** @param value - Toggle identity. @param pressed - Requested next state. */
function toggle(value: string, pressed: boolean): void {
  if (value === "bold") bold.value = pressed;
  if (value === "fill") fill.value = pressed;
  lastAction.value = `${value === "bold" ? "加粗" : "填充"}：${pressed ? "开启" : "关闭"}`;
}
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
  <div class="grid min-w-0 gap-qk-group p-qk-surface" data-toolbar-configured>
    <div class="grid justify-items-start gap-qk-inline">
      <p class="m-0 text-qk-helper text-qk-text-secondary">边框工具栏</p>
      <QuireToolbar label="文档快捷工具" variant="outlined" :items="items" @select="lastAction = $event" @toggle="toggle" />
    </div>
    <div class="grid justify-items-start gap-qk-inline">
      <p class="m-0 text-qk-helper text-qk-text-secondary">阴影工具栏</p>
      <QuireToolbar label="独立编辑工具" variant="elevated" :items="items" @select="lastAction = $event" @toggle="toggle" />
    </div>
    <div class="grid justify-items-start gap-qk-inline">
      <p class="m-0 text-qk-helper text-qk-text-secondary">嵌入工具栏</p>
      <QuireToolbar label="嵌入编辑工具" :items="items" @select="lastAction = $event" @toggle="toggle" />
    </div>
    <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ lastAction }}</p>
  </div>
  </QuireIconProvider>
</template>
```

## 多行工具栏

`rows` 将操作固定为多行，每行提供稳定的 `value`、可访问名称 `label` 与 `items`。所有行共用一个 Toolbar 表面、按钮焦点序列和横向滚动区域；`variant="elevated"` 可直接用作多行浮动工具栏，不必在 Popover 中嵌入多条 `plain` 工具栏。

`rows` 使用水平行布局，优先于 `items` 和 `orientation`；默认插槽仍优先。各行复用 `item` / `content` 插槽和 renderers，事件 `path` 包含行的 `value`。行可通过 `hidden` 隐藏或 `disabled` 整组禁用。

左右键按行序跨行移动，Home/End 到达整条工具栏首尾；上下键留给下拉等控件。所有按钮共享一个 Tab 停靠点，输入字段继续保留自己的 Tab 行为。窄容器整体横向滚动，不自动打散行内分组。

### 示例：toolbar/rows

文件：`rows.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry, type QuireKitToolbarExecuteEvent, type QuireKitToolbarRow } from "@quirekit/ui";
import { QuireButton, QuireIconProvider, QuireToolbar } from "@quirekit/ui/vue";

const narrow = ref(false);
const bold = ref(false);
const italic = ref(false);
const merged = ref(false);
const notice = ref("文字与单元格操作共用一个工具栏。");
const rows = computed<readonly QuireKitToolbarRow[]>(() => [
  { value: "text", label: "文字操作", items: [
    { value: "bold", label: "切换示例加粗", icon: "bold", kind: "toggle", pressed: bold.value },
    { value: "italic", label: "切换示例斜体", icon: "italic", kind: "toggle", pressed: italic.value },
    { value: "reset", label: "重置示例文字格式", text: "重置格式", icon: "clearFormatting" }
  ] },
  { value: "cells", label: "单元格操作", items: [
    { value: "merge", label: "切换示例合并", text: merged.value ? "取消合并" : "合并单元格", icon: "tableMergeCells", kind: "toggle", pressed: merged.value },
    { value: "unavailable", label: "删除受保护表格", text: "删除表格", icon: "tableDeleteGroup", disabled: true, disabledReason: "示例表格受保护" }
  ] }
]);

/** @param event - One intent with row ancestry; the sample owns all visible values. */
function execute(event: QuireKitToolbarExecuteEvent): void {
  if (event.value === "bold") bold.value = event.pressed === true;
  if (event.value === "italic") italic.value = event.pressed === true;
  if (event.value === "merge") merged.value = event.pressed === true;
  if (event.value === "reset") bold.value = italic.value = false;
  notice.value = `操作路径：${event.path.join(" / ")}`;
}
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid gap-qk-group p-qk-surface" data-toolbar-rows-example>
      <div><QuireButton variant="ghost" @click="narrow = !narrow">{{ narrow ? '恢复自然宽度' : '切换窄容器' }}</QuireButton></div>
      <div class="min-w-0 max-w-full" :style="{ width: narrow ? '180px' : 'max-content' }">
        <QuireToolbar label="多行文档工具" :rows="rows" variant="elevated" align="start" @execute="execute" />
      </div>
      <div class="grid max-w-80 grid-cols-2 gap-px bg-qk-border-subtle border border-solid border-qk-border-subtle"
        :style="{ fontWeight: bold ? 700 : 400, fontStyle: italic ? 'italic' : 'normal' }">
        <div class="bg-qk-surface-page p-qk-inline" :class="merged && 'col-span-2'">{{ merged ? '设计评审 · 待确认' : '设计评审' }}</div>
        <div v-if="!merged" class="bg-qk-surface-page p-qk-inline">待确认</div>
      </div>
      <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ notice }}</p>
    </div>
  </QuireIconProvider>
</template>
```

## 宽度单位

`sizing="units"` 以图标按钮为 1 个单位排列控件，n 个单位的宽度同时包含它们之间的间距，因此各行的单位合计相同就能对齐。条目通过 `span` 声明单位数，可用半单位；未声明时，图标按钮为 1，带下拉指示的图标按钮和拆分按钮为 1.5，文字与自定义控件保持自然宽度。`unitsPerRow` 设定每行容量，超出后按单位换行。`sumQuireKitToolbarSpans` 可在配置时核对每行合计。

### 示例：toolbar/units

文件：`units.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry, sumQuireKitToolbarSpans, type QuireKitToolbarRow } from "@quirekit/ui";
import { QuireButton, QuireIconProvider, QuireToolbar } from "@quirekit/ui/vue";

const capacity = ref<number | undefined>(undefined);
const rows = computed<readonly QuireKitToolbarRow[]>(() => [
  { value: "text", label: "文字操作", items: [
    { value: "copy", label: "复制", icon: "copy" },
    { value: "style", label: "段落样式", kind: "menu", trigger: "selector", text: "正文", span: 5, items: [{ value: "body", label: "正文" }, { value: "heading", label: "标题 1" }] },
    { value: "bold", label: "加粗", icon: "bold", kind: "toggle", pressed: false },
    { value: "italic", label: "斜体", icon: "italic", kind: "toggle", pressed: false },
    { value: "align", label: "对齐", icon: "alignStart", kind: "menu", trigger: "disclosure", items: [{ value: "start", label: "左对齐" }, { value: "center", label: "居中" }] }
  ] },
  { value: "table", label: "表格操作", items: [
    { value: "insert", label: "插入行列", icon: "tableInsert", kind: "menu", trigger: "disclosure", items: [{ value: "row", label: "在下方插入行" }] },
    { value: "delete", label: "删除", icon: "tableDelete", kind: "menu", trigger: "disclosure", items: [{ value: "row", label: "删除行" }] },
    { value: "merge", label: "合并单元格", icon: "tableMergeCells" },
    { value: "rows", label: "均分行高", icon: "tableDistributeRows" },
    { value: "columns", label: "均分列宽", icon: "tableDistributeColumns" },
    { value: "style", label: "表格样式", icon: "tableStyle", kind: "menu", trigger: "disclosure", items: [{ value: "grid", label: "网格型" }] },
    { value: "more", label: "更多", icon: "moreHorizontal", kind: "menu", trigger: "disclosure", indicator: false, items: [{ value: "select", label: "选择表格" }] }
  ] }
]);
const totals = computed(() => rows.value.map(row => `${row.label} ${sumQuireKitToolbarSpans(row.items)} 单位`).join("，"));
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid gap-qk-group p-qk-surface" data-toolbar-units-example>
      <div><QuireButton variant="ghost" @click="capacity = capacity === undefined ? 8 : undefined">{{ capacity === undefined ? '每行限 8 单位' : '取消行容量' }}</QuireButton></div>
      <div class="min-w-0 max-w-full">
        <QuireToolbar label="按单位排列的工具栏" :rows="rows" variant="elevated" align="start" sizing="units" :units-per-row="capacity" />
      </div>
      <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ totals }}</p>
    </div>
  </QuireIconProvider>
</template>
```

## 横向滚动

拖动宽度滑块观察同一条工具栏：内容溢出时出现左右箭头，每次点击移动一段可见内容；到达对应端点后，箭头禁用。内容全部放得下时，两侧箭头都不显示，也不预留空间。

“显示精简操作”会动态移除次要分组，再次展开时保留已有格式。“从右向左”会同时切换排列与滚动方向。工具栏中的格式、字号、批注和保存操作会更新下方阅读计划。

### 示例：toolbar/scrolling

文件：`scrolling.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry, type QuireKitToolbarEntry, type QuireKitToolbarExecuteEvent } from "@quirekit/ui";
import { QuireButton, QuireField, QuireIconProvider, QuireInput, QuireSelect, QuireSlider, QuireSwitch, QuireToolbar } from "@quirekit/ui/vue";

const width = ref([560]);
const rtl = ref(false);
const compact = ref(false);
const scrollbar = ref("hidden");
const title = ref("春日阅读计划");
const bold = ref(false);
const italic = ref(false);
const underline = ref(false);
const quoted = ref(false);
const alignment = ref<"start" | "center" | "end">("start");
const fontSize = ref(16);
const comment = ref(false);
const status = ref("选择格式，让阅读计划更清晰。");
const scrollbarOptions = [
  { value: "hidden", label: "隐藏滚动条（默认）" },
  { value: "auto", label: "显示系统滚动条" }
];
const items = computed<readonly QuireKitToolbarEntry[]>(() => {
  const format: QuireKitToolbarEntry = {
    value: "format", label: "文字格式", kind: "group", children: [
      { value: "bold", label: "加粗阅读计划", icon: "bold", kind: "toggle", pressed: bold.value },
      { value: "italic", label: "斜体阅读计划", icon: "italic", kind: "toggle", pressed: italic.value },
      { value: "underline", label: "下划线阅读计划", icon: "underline", kind: "toggle", pressed: underline.value }
    ]
  };
  if (compact.value) return [format];
  return [
    format,
    { value: "format-separator", label: "", kind: "separator" },
    { value: "paragraph", label: "段落格式", kind: "group", children: [
      { value: "align-start", label: "起始对齐", text: "起始对齐", icon: "alignLeft", kind: "toggle", pressed: alignment.value === "start" },
      { value: "align-center", label: "居中对齐", text: "居中对齐", icon: "alignCenter", kind: "toggle", pressed: alignment.value === "center" },
      { value: "align-end", label: "末尾对齐", text: "末尾对齐", icon: "alignRight", kind: "toggle", pressed: alignment.value === "end" }
    ] },
    { value: "paragraph-separator", label: "", kind: "separator" },
    { value: "reading", label: "阅读设置", kind: "group", children: [
      { value: "size", label: "阅读字号", text: `${fontSize.value} px`, kind: "menu", items: [
        { value: "size-16", label: "标准字号 · 16 px" },
        { value: "size-20", label: "舒适字号 · 20 px" },
        { value: "size-24", label: "大号字号 · 24 px" }
      ] },
      { value: "quote", label: "标记引用", text: "标记引用", icon: "messageSquarePlus", kind: "toggle", pressed: quoted.value }
    ] },
    { value: "review-separator", label: "", kind: "separator" },
    { value: "review", label: "文档操作", kind: "group", children: [
      { value: "comment", label: "添加阅读批注", text: "添加批注", icon: "messageSquarePlus" },
      { value: "reset", label: "重置阅读格式", text: "重置格式", icon: "undo" },
      { value: "save", label: "保存阅读计划", text: "保存计划", icon: "save" }
    ] }
  ];
});

/**
 * Apply one toolbar intent to the reading preview; scrolling never executes it.
 * @param event - Action, toggle or menu choice emitted by the public toolbar.
 */
function execute(event: QuireKitToolbarExecuteEvent): void {
  const value = event.value;
  if (value === "bold") bold.value = event.pressed === true;
  else if (value === "italic") italic.value = event.pressed === true;
  else if (value === "underline") underline.value = event.pressed === true;
  else if (value === "quote") quoted.value = event.pressed === true;
  else if (value === "align-start") alignment.value = "start";
  else if (value === "align-center") alignment.value = "center";
  else if (value === "align-end") alignment.value = "end";
  else if (value.startsWith("size-")) fontSize.value = Number(value.slice(5));
  else if (value === "comment") comment.value = true;
  else if (value === "reset") {
    bold.value = false; italic.value = false; underline.value = false;
    quoted.value = false; alignment.value = "start"; fontSize.value = 16;
  }
  status.value = value === "save" ? `已保存《${title.value || "未命名计划"}》。` : "阅读计划已更新。";
}
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid min-w-0 gap-qk-group p-qk-surface" data-toolbar-scrolling>
      <div class="flex min-w-0 flex-wrap items-end gap-qk-surface">
        <QuireSlider v-model="width" label="滚动工具栏宽度" :min="280" :max="960" :step="20" unit="px" class="w-full max-w-sm" />
        <QuireSwitch v-model:checked="rtl" label="从右向左" />
        <QuireSelect v-model="scrollbar" label="滚动条样式" :items="scrollbarOptions" width="200px" />
        <QuireButton variant="outline" size="sm" @click="compact = !compact">
          {{ compact ? "显示完整操作" : "显示精简操作" }}
        </QuireButton>
      </div>
      <div :dir="rtl ? 'rtl' : 'ltr'" class="grid min-w-0 max-w-full gap-qk-surface" :style="{ width: `${width[0]}px` }">
        <QuireToolbar
          label="阅读计划工具栏"
          variant="elevated"
          :scrollbar="scrollbar === 'auto' ? 'auto' : 'hidden'"
          :items="items"
          @execute="execute"
        />
        <QuireField label="阅读计划标题" width="100%">
          <template #default="{ controlProps }">
            <QuireInput v-bind="controlProps" v-model="title" width="100%" />
          </template>
        </QuireField>
        <article class="grid min-w-0 gap-qk-inline text-qk-text-primary" :style="{ textAlign: alignment }">
          <h3 class="m-0 text-qk-heading">{{ title || "未命名计划" }}</h3>
          <p
            class="m-0 leading-relaxed"
            :class="{ 'font-bold': bold, italic, underline, 'border-s-2 border-qk-border-default ps-qk-inline': quoted }"
            :style="{ fontSize: `${fontSize}px` }"
          >每天留一点时间读书，记录一个值得分享的想法。周末回看笔记，让零散的发现慢慢连成自己的思考。</p>
          <p v-if="comment" class="m-0 text-qk-helper text-qk-text-secondary">批注：下次读书会分享这一段。</p>
        </article>
      </div>
      <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ status }}</p>
    </div>
  </QuireIconProvider>
</template>
```

| 属性 | 默认值 | 用途 |
| --- | --- | --- |
| `overflow` | 桌面 `"scroll"`；移动 `items` 为 `"collapse"` | 横向溢出由 Toolbar 滚动；`"collapse"` 把末尾条目收进「更多」；`"visible"` 关闭内置滚动，内容按自然宽度展示 |
| `scrollbar` | `"hidden"` | 隐藏系统滚动条；`"auto"` 交给浏览器和系统设置决定何时显示 |
| `align` | `"center"` | 横向内容放得下时居中；`"start"` 保持起始对齐，溢出时均从起始侧展示 |

滚动箭头与「更多」的可访问名称跟随 [Locale Provider](/raw/components/locale-provider.md) 的语言。两种滚动条外观都保留触控板横向滚动、触摸拖动与原生滚动能力。隐藏滚动条只改变外观，不会移除超出视口的命令；键盘移动到视口外的控件时，会自动滚动到该控件。控件能放入视口时完整展示，超宽控件对齐起始侧。

鼠标位于可滚动内容上时，普通纵向滚轮会转换为横向滚动；到达对应端点后交回页面。
输入框、选择器、滑块、浮层及内部可滚动区域保留自己的滚轮行为，带修饰键的手势与已有横向滚动也不转换。

给工具栏一个受约束的可用宽度即可，外观 `variant` 与滚动策略独立。父级使用 flex 或 grid 布局时，应允许所在列收缩，例如设置 `min-width: 0`；不要再用 `width: max-content` 撑开整条工具栏或叠加第二个横向滚动层。

```vue
<template>
  <div style="width: 640px; max-width: 100%; min-width: 0">
    <QuireToolbar label="文档操作" variant="elevated" :items="items" />
  </div>
</template>
```

`items` 沿用上方数据配置。只有外层已经明确负责内容空间、需要保留自然尺寸时，才使用 `overflow="visible"`；该模式不会自动收纳或避免外层溢出。纵向 Toolbar 保持自然布局，不启用上述横向箭头与滚动条策略。

## 完整配置：按钮与自定义弹窗

下面整条工具栏由 `items` 生成：加粗开关、字号 Selector、颜色控件、编辑标题 Disclosure、字号 Split Button、菜单和保存动作。切换“只读文档”会动态禁用编辑操作；选择字号、修改颜色、编辑标题都实际更新下方预览。

字号面板复用 Listbox：整行悬停反馈，勾选标明当前字号；方向键移动候选，Enter 确认，Escape 取消并返回触发按钮。

`contentPadding` 默认保留 Popover 的内容留白。嵌入 Listbox 等自带边缘的控件时设为 `"none"`，由子控件单独负责内边距；字号列表外缘为 4px，标题表单保持默认 16px。

### 示例：toolbar/configuration

文件：`configuration.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import type { QuireKitToolbarEntry, QuireKitToolbarExecuteEvent, QuireKitToolbarOpenChangeEvent } from "@quirekit/ui";
import { QuireCheckbox, QuireIconProvider, QuireToolbar } from "@quirekit/ui/vue";
import type { QuireKitToolbarRenderers } from "@quirekit/ui/vue";
import FontOptions from "./configuration/font-options.vue";
import TitlePanel from "./configuration/title-panel.vue";
import ColorControl from "./configuration/color-control.vue";
import type { ToolbarDocumentSnapshot } from "./configuration/types";

const title = ref("季度设计计划");
const fontSize = ref(16);
const color = ref("#425bea");
const bold = ref(false);
const locked = ref(false);
const titleOpen = ref(false);
const lastAction = ref("通过配置中的按钮修改下方文档");
// The host projects state; renderers receive no editor instance or transaction dependency.
const context = computed<ToolbarDocumentSnapshot>(() => ({ title: title.value, fontSize: fontSize.value, color: color.value }));
const renderers: QuireKitToolbarRenderers = { fontOptions: FontOptions, titlePanel: TitlePanel, colorControl: ColorControl };
const items = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "format", label: "文档格式", kind: "group", disabled: locked.value, children: [
    { value: "bold", label: "切换加粗", icon: "bold", kind: "toggle", pressed: bold.value, meta: "bold" },
    { value: "size", label: "选择字号", text: `${fontSize.value} px`, kind: "selector", contentRenderer: "fontOptions", contentPadding: "none", meta: "fontSize" },
    { value: "color", label: "配置文字颜色", kind: "custom", renderer: "colorControl", meta: "color" },
    { value: "title", label: "编辑标题", icon: "edit", kind: "disclosure", contentRenderer: "titlePanel", expanded: titleOpen.value, meta: "title" }
  ] },
  { value: "separator", label: "", kind: "separator" },
  { value: "applySize", label: "应用字号", kind: "split", text: `${fontSize.value} px`, actionLabel: "应用当前字号",
    disclosureLabel: "选择并应用字号", contentRenderer: "fontOptions", contentPadding: "none", payload: fontSize.value, meta: "fontSize", disabled: locked.value },
  { value: "more", label: "更多操作", kind: "menu", items: [
    { value: "reset", label: "恢复默认格式", disabled: locked.value },
    { value: "save", label: "保存文档", disabled: locked.value }
  ] },
  { value: "save", label: "保存文档", icon: "save", disabled: locked.value, meta: "save" }
]);
/** @param event - Controlled popup request; the host may capture its editor target here. */
function openChange(event: QuireKitToolbarOpenChangeEvent): void {
  if (event.item.value === "title") titleOpen.value = event.expanded;
}
/**
 * Resolve the command against current host state, never a stale renderer closure.
 * A real editor adapter performs its canExecute/target checks at this boundary.
 * @param event - Guarded intent carrying entry metadata, ancestry and parameters.
 */
function execute(event: QuireKitToolbarExecuteEvent): void {
  if (locked.value) return;
  const command = event.source === "menu" ? event.value : event.item.meta;
  if (command === "bold") bold.value = event.pressed === true;
  if (command === "fontSize" && typeof event.payload === "number") fontSize.value = event.payload;
  if (command === "color" && typeof event.payload === "string") color.value = event.payload;
  if (command === "title" && typeof event.payload === "string") title.value = event.payload;
  if (command === "reset") { fontSize.value = 16; bold.value = false; color.value = "#425bea"; }
  lastAction.value = command === "save" ? `已保存「${title.value}」` : `${event.path.join(" / ")}：已应用`;
}
</script>
<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid min-w-0 gap-qk-group p-qk-surface">
      <QuireCheckbox :checked="locked" @update:checked="locked = $event === true" label="只读文档（动态禁用编辑操作）" />
      <div class="min-w-0 max-w-full p-qk-inline">
        <QuireToolbar label="配置式文档工具栏" class="w-full" variant="elevated" :items="items" :renderers="renderers" :context="context"
          preserve-focus @execute="execute" @open-change="openChange" />
      </div>
      <article class="rounded-qk-surface bg-qk-surface-subtle p-qk-surface">
        <h3 class="m-0 mb-qk-group text-qk-heading-sm">{{ title }}</h3>
        <p class="m-0" :style="{ fontSize: `${fontSize}px`, fontWeight: bold ? 700 : 400, color }">让重要内容容易被发现，让每次操作都有明确的反馈。</p>
      </article>
      <output class="text-qk-helper text-qk-text-secondary">{{ lastAction }}</output>
    </div>
  </QuireIconProvider>
</template>
```

文件：`configuration/font-options.vue`

```vue
<script setup lang="ts">
import { computed } from "vue";
import { QuireListbox } from "@quirekit/ui/vue";
import type { QuireKitListboxValueChangeDetails } from "@quirekit/ui";
import type { QuireKitToolbarRendererScope } from "@quirekit/ui/vue";
import type { ToolbarDocumentSnapshot } from "./types";
const { scope } = defineProps<{
  /** Current host snapshot and guarded execution callback. */
  scope: QuireKitToolbarRendererScope;
}>();
const items = [14, 16, 20, 24].map(size => ({ value: String(size), label: `${size} px` }));
const selected = computed(() => [String((scope.context as ToolbarDocumentSnapshot).fontSize)]);
/** @param details - Committed selection; keyboard highlighting alone does not apply formatting. */
function choose(details: QuireKitListboxValueChangeDetails): void {
  const size = details.value[0];
  if (scope.disabled || size === undefined) return;
  scope.execute(Number(size));
  scope.setExpanded(false);
}
</script>
<template>
  <QuireListbox class="min-w-40" label="选择字号" hide-label density="compact"
    :items="items" :model-value="selected" :disabled="scope.disabled" @value-change="choose" />
</template>
```

文件：`configuration/types.ts`

```ts
/** Read-only projection supplied by this demo's document owner. */
export interface ToolbarDocumentSnapshot {
  /** Current document title. */
  readonly title: string;
  /** Font size in pixels. */
  readonly fontSize: number;
  /** Current text color. */
  readonly color: string;
}
```

文件：`configuration/title-panel.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { QuireButton, QuireInput } from "@quirekit/ui/vue";
import type { QuireKitToolbarRendererScope } from "@quirekit/ui/vue";
import type { ToolbarDocumentSnapshot } from "./types";
const { scope } = defineProps<{
  /** Live host context; the local draft is discarded on close. */
  scope: QuireKitToolbarRendererScope;
}>();
const draft = ref((scope.context as ToolbarDocumentSnapshot).title);
/** Submit the local draft through the application command bridge. */
function apply(): void {
  if (!draft.value.trim() || scope.disabled) return;
  scope.execute(draft.value.trim());
  scope.setExpanded(false);
}
</script>
<template>
  <form class="grid gap-qk-group w-64 max-w-full" @submit.prevent="apply">
    <label class="grid gap-qk-inline">
      <span>文档标题</span>
      <QuireInput v-model="draft" aria-label="新的文档标题" :disabled="scope.disabled" />
    </label>
    <div class="flex justify-end gap-qk-inline">
      <QuireButton variant="text" @click="scope.setExpanded(false)">取消</QuireButton>
      <QuireButton type="submit" color="primary" variant="solid" :disabled="scope.disabled || !draft.trim()">应用</QuireButton>
    </div>
  </form>
</template>
```

文件：`configuration/color-control.vue`

```vue
<script setup lang="ts">
import { computed } from "vue";
import { QuireColorPicker, QuireIcon, QuireToolbarColorPickerDisclosure } from "@quirekit/ui/vue";
import type { QuireKitToolbarRendererScope } from "@quirekit/ui/vue";
import type { ToolbarDocumentSnapshot } from "./types";
const { scope } = defineProps<{
  /** Custom controls use the same reactive context and guarded intent bridge. */
  scope: QuireKitToolbarRendererScope;
}>();
const color = computed(() => (scope.context as ToolbarDocumentSnapshot).color);
</script>
<template>
  <QuireColorPicker :model-value="color" :open="scope.expanded" :label="scope.item.label" :disabled="scope.disabled" :allow-reset="false"
    @update:open="scope.setExpanded" @update:model-value="scope.execute($event)">
    <template #trigger>
      <QuireToolbarColorPickerDisclosure :label="scope.item.label" :disabled="scope.disabled">
        <QuireIcon name="textColor" :accent-color="color" />
      </QuireToolbarColorPickerDisclosure>
    </template>
  </QuireColorPicker>
</template>
```

| 配置 | 渲染与行为 |
| --- | --- |
| `action` / `toggle` | 即时动作 / 受控开关；`pressed` 支持 `mixed` |
| `menu` + `items` | 数据菜单，支持分组、子菜单、Checkbox 和 Radio 等 Menu 条目 |
| `selector` + `contentRenderer` | 显示当前值，打开自定义 Popover 内容 |
| `disclosure` + `contentRenderer` | 图标或文字按钮打开自定义 Popover 内容 |
| `split` + `contentRenderer` | 主按钮执行 `payload`，旁边按钮打开自定义 Popover；两侧可单独禁用 |
| `split` + `items` | 主按钮执行当前操作，旁边按钮打开声明式 Menu；菜单事件携带所选叶子的 `value` |
| `custom` + `renderer` | 完整自定义 Vue 控件，可组合 ColorPicker、Dialog 或其他弹窗 |
| `group` / `separator` | 分组 / 短分隔线；分组禁用会传递给后代 |

普通操作菜单使用 `trigger: "disclosure"`，显示图标或文字及展开标识；显示当前值的菜单使用默认 `trigger: "selector"`。selector 外观与 Select 一致：字段边框、页面底色、文字左对齐、箭头靠右，与无边框的操作按钮区分；自定义控件使用 `QuireToolbarSelector` 时同样如此。`disclosure` 未配置弹窗内容时只发出执行与展开请求，可打开宿主管理的 Dialog 或侧栏；配置了 `contentRenderer` 或 `content` 插槽时才组合 Popover。长期侧栏入口设置 `popup: false`，保留展开状态和 Tooltip，不声明弹窗语义；外部 Dialog 入口保持默认值。带弹窗的 Disclosure 支持按 ↓ 打开，焦点和关闭由相应浮层管理。

配置条目的 `indicator` 控制 Disclosure 的展开箭头。菜单的 Disclosure 默认显示，普通 Disclosure 可按入口语义启用；直接执行动作的按钮无需展开箭头。

`iconData` 可直接提供规范化图标，优先于 `icon` 注册名；`iconAccentColor` 与 `iconEmpty` 表达当前颜色或清除状态。它们只调整图标已有的状态部位。`attributes` 放置宿主的 `data-*` 标记。`overlayProps` 支持 `portalTarget`、菜单宽度与 `closeOnSelect`，其 `contentAttributes` 可提供 `class`、`lang`、`dir` 和 `data-*`。异步操作需要成功后关闭时，设 `closeOnSelect: false` 并由宿主更新受控 `expanded`。

`renderers` 是名称到 Vue 组件的映射；打开示例的“源码”页签可查看主配置和各注册组件的完整代码。注册组件接收一个 `scope` 属性，包含最新的 `item`、`path`、`context`、`disabled`、`expanded`、`execute(payload?)` 和 `setExpanded(open)`。组件仍使用正常的 Vue props、watch 和卸载生命周期。弹窗草稿放在弹窗组件内，取消只关闭，应用才提交。

```vue
<script setup lang="ts">
import { QuireToolbar } from '@quirekit/ui/vue'
import TitlePanel from './TitlePanel.vue'

const renderers = { titlePanel: TitlePanel }
const items = [{
  value: 'rename', label: '编辑标题', kind: 'disclosure' as const,
  contentRenderer: 'titlePanel', meta: { command: 'rename' }
}]
</script>

<template>
  <QuireToolbar label="文档操作" :items="items" :renderers="renderers"
    :context="documentSnapshot" @execute="executeDocumentCommand" />
</template>
```

`documentSnapshot` 与 `executeDocumentCommand` 由应用提供，完整写法见上方示例源码。内置的 selector、disclosure、split 使用 Popover 管理定位、Escape、外部点击和焦点恢复；split 配置 `items` 时优先使用 Menu，复用菜单键盘导航和回焦。`custom` 则由注册控件拥有整个浮层。未注册的自定义项可回退到 `item` 插槽，弹窗内容可回退到 `content` 插槽，它们接收相同 scope。

手写 `QuireMenu` 或 `QuirePopoverTrigger as-child` 包裹 `QuireToolbarSelector` / `QuireToolbarDisclosure` 时，设置 `:toggle-on-click="false"`，让外层浮层独占点击展开状态。↓ 键仍可请求打开 Popover；裸按钮默认自行发出展开请求。配置式条目和 Split 内置浮层已经自动处理这一边界。

任意自定义按钮应组合 `QuireToolbarAction`、`QuireToolbarToggle` 等公开控件，以保留方向键导航；必须直接绘制原生按钮时，可用 `useQuireToolbarItem(() => disabled)` 注册，并绑定返回的 `element`、`id`、`tabIndex`、`handleFocus` 和 `data-qk-toolbar-item`。普通弹窗里的输入、按钮不注册到工具栏导航。

## 应用与编辑器接入

Toolbar 只负责呈现和交互意图，应用适配层负责命令与目标：

1. 将当前权限、选区与命令状态投影为 `items`：不可见用 `hidden`，不可用用 `disabled`，开关状态用 `pressed`，当前显示值用 `text`。同组内 `value` 必须稳定且唯一。
2. 通过 `meta` 关联宿主命令，`payload` 传递默认参数；`context` 提供自定义控件需要的状态或服务。这些值都是不透明的宿主数据，UI 包不导入编辑器实例、事务或 schema。
3. 监听 `execute(event)`：取得 `item`、`value`、`path`、`source`、`payload` 和可选 `pressed`，在执行时重新校验命令权限与目标有效性，再调用宿主命令。直接激活还提供可选 `nativeEvent`，宿主可在回调内保存触发元素，供弹窗关闭后恢复焦点；自定义控件可用 `scope.execute(payload, nativeEvent)` 传递原事件。菜单的 `item` 是触发器，`value` 是选中的菜单条目；`path` 为分组、触发器和选中菜单值，菜单内部路径由应用依据菜单数据解析。
4. 通过 `openChange` 观察或控制弹窗。传入 `expanded` 时，应用必须将请求状态写回；省略时由条目维护本地状态。复杂控件可在打开时保存编辑目标，提交时映射和验证目标，取消时丢弃草稿。

`execute` 与兼容事件 `select` / `toggle` 会同时发出；选择一套事件执行业务命令，避免执行两次。自定义回调会重新检查当前可用性，条目卸载后不再提交，但 Toolbar 不替宿主验证过期的编辑目标。

`preserve-focus` 仅阻止鼠标主键按下工具栏按钮时抢走焦点，保留键盘和触摸的正常行为，也不会阻止弹窗输入框获取焦点。它不能代替编辑器的选区书签机制；浮层中的输入、异步命令和协作更新仍由编辑器管理目标。

## 基础用法

Action 通过 `activate` 执行动作；Toggle 通过 `v-model` 保存开关状态。每个图标按钮都需要 `label`。工具栏只发送命令或更新控件值，正文如何应用由调用方决定。

### 示例：toolbar/basic

文件：`basic.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import {
  QuireIcon,
  QuireIconProvider,
  QuireToolbar,
  QuireToolbarAction,
  QuireToolbarSeparator,
  QuireToolbarToggle
} from "@quirekit/ui/vue";
const bold = ref(false);
const italic = ref(false);
const saves = ref(0);
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid min-w-0 justify-items-start gap-4 p-qk-surface">
      <QuireToolbar label="笔记格式">
        <QuireToolbarAction label="保存笔记" @activate="saves++">
          <QuireIcon name="save" />
        </QuireToolbarAction>
        <QuireToolbarSeparator />
        <QuireToolbarToggle v-model="bold" label="加粗笔记">
          <QuireIcon name="bold" />
        </QuireToolbarToggle>
        <QuireToolbarToggle v-model="italic" label="斜体笔记">
          <QuireIcon name="italic" />
        </QuireToolbarToggle>
      </QuireToolbar>
      <p class="m-0" :class="{ 'font-bold': bold, italic }">
        这是一段可调整格式的笔记。
      </p>
      <output>已保存 {{ saves }} 次</output>
    </div>
  </QuireIconProvider>
</template>
```

## 选区浮动工具栏

选中文字后，在选区附近显示复制、摘录等快捷操作。使用 Popover 负责定位与边缘避让，Toolbar 负责操作和方向键导航；阴影、圆角与内边距只由 Toolbar 提供。

在下面段落中选择文字，或点击“选择示例文字”。`Alt + F10` 从段落进入工具栏，`Escape` 返回段落并保留选区。摘录操作显示实际选中的内容。

### 示例：toolbar/selection

文件：`selection.vue`

```vue
<script setup lang="ts">
import { nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import { QuireButton, QuireIconProvider, QuirePopoverAnchor, QuirePopoverContent, QuirePopoverRoot, QuireToolbar } from "@quirekit/ui/vue";

const host = ref<HTMLElement>();
const passage = ref<HTMLElement>();
const panel = ref<HTMLElement>();
const open = ref(false);
const selected = ref("");
const excerpt = ref("");
const notice = ref("选择下面的文字，或使用“选择示例文字”。");
const anchor = ref({ left: "0px", top: "0px", width: "1px", height: "1px" });
let savedRange: Range | undefined;
let dismissed = false;
let resize: ResizeObserver | undefined;
const items = [
  { value: "copy", label: "复制选中文字", icon: "copy", text: "复制" },
  { value: "quote", label: "摘录选中文字", icon: "messageSquarePlus", text: "摘录" },
  { value: "close", label: "关闭选区工具栏", icon: "close" }
];

/** Project the live DOM range into the demo's local anchor coordinates. */
function position(): void {
  if (!savedRange || !host.value) return;
  const rect = savedRange.getBoundingClientRect();
  const parent = host.value.getBoundingClientRect();
  anchor.value = { left: `${rect.left - parent.left}px`, top: `${rect.top - parent.top}px`, width: `${Math.max(1, rect.width)}px`, height: `${rect.height}px` };
}

/** Capture only ranges entirely inside this passage; toolbar focus preserves the saved range. */
function capture(): void {
  if (dismissed || panel.value?.contains(document.activeElement)) return;
  const selection = window.getSelection();
  if (!selection?.rangeCount || selection.isCollapsed) { open.value = false; return; }
  const range = selection.getRangeAt(0);
  if (!passage.value?.contains(range.startContainer) || !passage.value.contains(range.endContainer)) { open.value = false; return; }
  savedRange = range.cloneRange();
  selected.value = selection.toString();
  position();
  open.value = true;
}

/** Restore the original range after keyboard commands without changing its text. */
function restore(): void {
  passage.value?.focus({ preventScroll: true });
  if (!savedRange) return;
  const selection = window.getSelection();
  selection?.removeAllRanges();
  selection?.addRange(savedRange);
}

/** Close after pending selection notifications so Escape does not immediately reopen it. */
function dismiss(): void {
  dismissed = true;
  restore();
  open.value = false;
}

/** @param value - Action requested for the saved selection. @returns Completion of the clipboard or excerpt action. */
async function act(value: string): Promise<void> {
  if (value === "close") { dismiss(); return; }
  if (value === "quote") { excerpt.value = selected.value; notice.value = "已添加到摘录。"; }
  if (value === "copy") {
    try { await navigator.clipboard.writeText(selected.value); notice.value = "已复制选中文字。"; }
    catch { notice.value = "复制未完成，请使用系统复制快捷键。"; }
  }
}

/** Create a real text range for keyboard and touch users. @returns Completion after toolbar controls mount. */
async function selectExample(): Promise<void> {
  if (!passage.value) return;
  dismissed = false;
  passage.value.focus();
  const range = document.createRange();
  range.selectNodeContents(passage.value);
  window.getSelection()?.removeAllRanges();
  window.getSelection()?.addRange(range);
  capture();
  await nextTick();
  panel.value?.querySelector<HTMLButtonElement>("button")?.focus();
}

/** @param event - Passage shortcut; Alt+F10 enters the open contextual toolbar. */
function enterToolbar(event: KeyboardEvent): void {
  if (event.shiftKey) dismissed = false;
  if (event.altKey && event.key === "F10" && savedRange) {
    event.preventDefault();
    dismissed = false;
    position();
    open.value = true;
    void nextTick(() => panel.value?.querySelector<HTMLButtonElement>("button")?.focus());
  }
}

onMounted(() => {
  document.addEventListener("selectionchange", capture);
  resize = new ResizeObserver(position);
  if (host.value) resize.observe(host.value);
});
onBeforeUnmount(() => { document.removeEventListener("selectionchange", capture); resize?.disconnect(); });
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div ref="host" class="relative grid gap-qk-group p-qk-surface">
      <div><QuireButton variant="text" @click="selectExample">选择示例文字</QuireButton></div>
      <p ref="passage" tabindex="0" aria-label="可选择的示例段落" class="m-0 max-w-prose leading-relaxed text-qk-text-primary" @pointerdown="dismissed = false" @keydown="enterToolbar">设计让重要内容容易被发现，也让每一次操作有清晰的反馈。选中一段值得保留的文字，将它添加到你的摘录中。</p>
      <QuirePopoverRoot v-model:open="open" placement="top" :auto-focus="false" :restore-focus="false" @escape-key-down="dismiss">
        <QuirePopoverAnchor><span aria-hidden="true" class="pointer-events-none absolute" :style="anchor" /></QuirePopoverAnchor>
        <QuirePopoverContent :show-arrow="false" aria-label="选区快捷操作" style="--qk-popover-padding: 0; --qk-popover-shadow: none; background: transparent; overflow: visible">
          <div ref="panel" @pointerdown.prevent>
            <QuireToolbar label="选区快捷工具" variant="elevated" :items="items" @select="act" />
          </div>
        </QuirePopoverContent>
      </QuirePopoverRoot>
      <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ notice }}</p>
      <blockquote v-if="excerpt" class="m-0 border-l-2 border-qk-border-subtle pl-qk-surface text-qk-text-secondary">{{ excerpt }}</blockquote>
    </div>
  </QuireIconProvider>
</template>
```

示例用浏览器文字选区更新独立 Anchor。接入编辑器时由编辑器提供选区位置和命令目标；不要因按钮取得焦点而清除原选区。

## 画布侧边、对象与缩放工具

纵向工具栏放置工作模式，底部短工具栏控制缩放，选中对象后显示专属操作。三者复用 `elevated` 外观，以不同的 `label` 区分键盘导航区域。

点击卡片调整圆角，切换预览后停止选择对象。底部缩放在 50%～150% 之间变化，点击百分比恢复到 100%。这是 DOM 工作区示例，定位和缩放由示例容器负责。

### 示例：toolbar/workspace

文件：`workspace.vue`

```vue
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
import { quireIconRegistry, type QuireKitToolbarEntry } from "@quirekit/ui";
import { QuireIconProvider, QuireToolbar } from "@quirekit/ui/vue";
const drawing = ref<HTMLElement>();
const drawingWidth = ref(180);
let observer: ResizeObserver | undefined;
const card = ref<HTMLButtonElement>();
const zoom = ref(100);
const mode = ref("design");
const selected = ref(false);
const rounded = ref(true);
const tools = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "design", label: "设计模式", text: "设计", icon: "square", kind: "toggle", pressed: mode.value === "design" },
  { value: "preview", label: "预览模式", text: "预览", icon: "search", kind: "toggle", pressed: mode.value === "preview" }
]);
const viewTools = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "out", label: "缩小画布", icon: "zoomOut", disabled: zoom.value <= 50 },
  { value: "reset", label: "重置缩放", text: `${zoom.value}%` },
  { value: "in", label: "放大画布", icon: "zoomIn", disabled: zoom.value >= 150 }
]);
const objectTools = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "round", label: "卡片圆角", text: "圆角", kind: "toggle", pressed: rounded.value },
  { value: "close", label: "取消选择卡片", icon: "close" }
]);
/** @param value - Requested workspace mode. */
function changeMode(value: string): void { mode.value = value; selected.value = false; }
/** @param value - Zoom action with bounded increments. */
function changeZoom(value: string): void { zoom.value = value === "reset" ? 100 : Math.max(50, Math.min(150, zoom.value + (value === "in" ? 25 : -25))); }
/** Return focus to the selected object when its toolbar is dismissed. */
function deselect(): void { selected.value = false; card.value?.focus(); }
onMounted(() => {
  // Bound the scaled object to the remaining canvas width without covering the tools.
  observer = new ResizeObserver(entries => { drawingWidth.value = entries[0]?.contentRect.width ?? 180; });
  if (drawing.value) observer.observe(drawing.value);
});
onBeforeUnmount(() => observer?.disconnect());
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid gap-qk-inline p-qk-surface">
      <div class="relative grid min-h-80 grid-cols-[auto_minmax(0,1fr)] items-start gap-qk-surface rounded-qk-overlay bg-qk-surface-subtle p-qk-surface">
        <QuireToolbar label="画布模式" orientation="vertical" variant="elevated" :items="tools" @toggle="changeMode" />
        <div ref="drawing" class="grid min-w-0 justify-items-center gap-qk-inline pb-16 pt-12">
          <QuireToolbar v-if="selected" label="卡片快捷工具" variant="elevated" :items="objectTools" class="absolute top-4" @toggle="rounded = $event === 'round' ? !rounded : rounded" @select="deselect" />
          <button ref="card" type="button" class="box-border max-w-full cursor-pointer border border-qk-border-subtle bg-qk-surface-page p-qk-surface text-left text-qk-text-primary" :class="[rounded ? 'rounded-qk-overlay' : '', selected ? '!border-qk-border-focus' : '']" :style="{ zoom: zoom / 100, width: `${Math.min(180, drawingWidth / (zoom / 100))}px` }" :disabled="mode === 'preview'" :aria-pressed="selected" aria-label="选择设计卡片" @click="selected = !selected">
            <span class="block text-qk-helper text-qk-text-tertiary">DESIGN NOTES</span>
            <strong class="my-3 block">让想法清晰可见</strong>
            <span class="block text-qk-helper text-qk-text-secondary">留白、层级与恰当的反馈。</span>
          </button>
        </div>
        <div class="absolute bottom-4 inset-x-4 flex justify-center"><QuireToolbar label="画布缩放" variant="elevated" :items="viewTools" @select="changeZoom" /></div>
      </div>
      <p class="m-0 text-qk-helper text-qk-text-secondary">{{ mode === 'design' ? '点击卡片显示对象工具；侧边切换预览，底部调整缩放。' : '预览模式：卡片不可选择，仍可调整缩放。' }}</p>
    </div>
  </QuireIconProvider>
</template>
```

## 批量操作

选择多项后显示操作栏，同时保留已选数量和取消入口。数据由页面维护，Toolbar 返回操作意图；操作完成后更新列表和选择状态。

### 示例：toolbar/batch

文件：`batch.vue`

```vue
<script setup lang="ts">
import { computed, nextTick, ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import { QuireButton, QuireCheckbox, QuireIconProvider, QuireToolbar } from "@quirekit/ui/vue";
const host = ref<HTMLElement>();
const documents = ["季度设计计划", "用户研究摘录", "组件使用指南"];
const selected = ref<string[]>([]);
const archived = ref<string[]>([]);
const notice = ref("选择文档进行批量操作。");
const visible = computed(() => documents.filter(name => !archived.value.includes(name)));
const items = [{ value: "archive", label: "归档所选文档", text: "归档", icon: "save" }, { value: "clear", label: "取消选择", text: "取消选择", icon: "close" }];
/** @param name - Document identity. @param checked - Requested checked state. */
function toggle(name: string, checked: boolean | "indeterminate"): void { selected.value = checked === true ? [...selected.value, name] : selected.value.filter(value => value !== name); }
/** @param value - Batch operation; all demo records remain recoverable. */
function act(value: string): void {
  if (value === "archive") { archived.value.push(...selected.value); notice.value = `已归档 ${selected.value.length} 份文档，可恢复。`; }
  else notice.value = "已取消选择。";
  selected.value = [];
  void nextTick(() => host.value?.querySelector<HTMLElement>('input[type="checkbox"], button')?.focus());
}
/** Restore the demo collection after a batch operation. */
function restore(): void {
  archived.value = [];
  notice.value = "已恢复全部文档。";
  void nextTick(() => host.value?.querySelector<HTMLInputElement>('input[type="checkbox"]')?.focus());
}
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div ref="host" class="grid gap-qk-surface p-qk-surface">
      <div class="flex min-h-12 flex-wrap items-center gap-qk-surface">
        <strong class="text-qk-text-primary">{{ selected.length ? `已选 ${selected.length} 项` : '工作区文档' }}</strong>
        <QuireToolbar v-if="selected.length" label="文档批量操作" variant="outlined" :items="items" @select="act" />
      </div>
      <div class="grid gap-qk-surface">
        <QuireCheckbox v-for="name in visible" :key="name" :label="name" :checked="selected.includes(name)" @update:checked="toggle(name, $event ?? false)" />
        <p v-if="!visible.length" class="m-0 text-qk-text-secondary">文档已全部归档。</p>
      </div>
      <div class="flex flex-wrap items-center gap-qk-inline">
        <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ notice }}</p>
        <QuireButton v-if="archived.length" variant="text" @click="restore">恢复文档</QuireButton>
      </div>
    </div>
  </QuireIconProvider>
</template>
```

## 窄容器与更多操作

默认横向滚动保留全部命令及其排列，适合需要稳定顺序的长工具栏（WPS 式左右滚动）。若希望常用操作始终可见，设置 `overflow="collapse"`：放不下时从末尾开始，按顶层条目或分组整组收进「更多」，点开后用同一套控件显示，操作标识与状态来源不变。

收纳只作用于 `items` 数据配置；默认插槽与 `rows` 多行模式保持自身布局。分隔线不会留在可见行末尾；被收起的控件持有焦点时，焦点移到「更多」。拖动滑块观察收纳顺序。

### 示例：toolbar/responsive

文件：`responsive.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry, type QuireKitToolbarEntry } from "@quirekit/ui";
import { QuireIconProvider, QuireSlider, QuireToolbar } from "@quirekit/ui/vue";

const width = ref([640]);
const bold = ref(false);
const italic = ref(false);
const underline = ref(false);
const alignment = ref("start");
const status = ref("缩小宽度，末尾的分组会依次收进“更多”。");
const items = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "history", label: "历史", kind: "group", children: [
    { value: "undo", label: "撤销", icon: "undo" },
    { value: "redo", label: "重做", icon: "redo" }
  ] },
  { value: "history-separator", label: "", kind: "separator" },
  { value: "format", label: "文字格式", kind: "group", children: [
    { value: "bold", label: "加粗", icon: "bold", kind: "toggle", pressed: bold.value },
    { value: "italic", label: "斜体", icon: "italic", kind: "toggle", pressed: italic.value },
    { value: "underline", label: "下划线", icon: "underline", kind: "toggle", pressed: underline.value }
  ] },
  { value: "format-separator", label: "", kind: "separator" },
  { value: "paragraph", label: "段落对齐", kind: "group", children: [
    { value: "start", label: "左对齐", icon: "alignStart", kind: "toggle", pressed: alignment.value === "start" },
    { value: "center", label: "居中", icon: "alignCenter", kind: "toggle", pressed: alignment.value === "center" },
    { value: "end", label: "右对齐", icon: "alignEnd", kind: "toggle", pressed: alignment.value === "end" }
  ] },
  { value: "paragraph-separator", label: "", kind: "separator" },
  { value: "insert", label: "插入", kind: "group", children: [
    { value: "link", label: "插入链接", icon: "link" },
    { value: "image", label: "插入图片", icon: "image" },
    { value: "table", label: "插入表格", icon: "table" }
  ] }
]);

/** @param value - Toggle identity, identical in the row and the "more" panel. @param pressed - Requested state. */
function toggle(value: string, pressed: boolean): void {
  if (value === "bold") bold.value = pressed;
  else if (value === "italic") italic.value = pressed;
  else if (value === "underline") underline.value = pressed;
  else alignment.value = value;
}

/** @param value - Action identity, identical in the row and the "more" panel. */
function act(value: string): void {
  status.value = `已执行：${value}`;
}
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid min-w-0 gap-qk-surface p-qk-surface">
      <QuireSlider v-model="width" label="工具栏容器宽度" :min="160" :max="640" :step="20" unit="px" class="max-w-sm" />
      <div class="box-border max-w-full" :style="{ width: `${width[0]}px` }">
        <QuireToolbar label="自动收纳的格式工具" variant="outlined" overflow="collapse" align="start" :items="items" @toggle="toggle" @select="act" />
      </div>
      <p role="status" class="m-0 text-qk-helper text-qk-text-secondary">{{ status }}</p>
    </div>
  </QuireIconProvider>
</template>
```

## 触控底部操作栏

使用 `mode="mobile"` 启用移动模式：内置按钮至少 44px，图标 20px，关闭 Toolbar 的所有内置 Tooltip。`mode="auto"` 按所属文档的 768px 布局断点切换；默认 `desktop` 保持已有桌面用法。可访问名称、方向键和真实输入字段的焦点规则始终保留。

只适合桌面的条目（例如打开桌面侧栏表单的入口）设置 `mobile: false`，移动模式下 `items`、`rows` 与分组都不渲染它，桌面模式不受影响。

移动配置式 `items` 默认按宽度收纳：空间充足时全部显示，只有放不下才出现“更多”，点击打开底部动作面板。面板复用原 Toggle、Split 和自定义 renderer；纵向移动 Toolbar 为普通配置项补上可见动作名称，不改变 `execute` 中的原 `item`、`path` 或参数。显式 `overflow` 优先；插槽与 `rows` 不自动收纳。

移动单位布局的 Split 至少占两个单位，主动作与展开入口各有 44px 热区。溢出面板最多占可用视口的 72%，长内容在正文区滚动，取消按钮固定在底部。

容器负责底部停靠与安全区，内部使用 `plain`；实际编辑器还需处理软键盘及命令目标。`overflowOpenChange(open, trigger)` 在焦点转移前提供本次原入口，`overflowContentElementChange(element | null)` 报告实际浮层的挂载与释放。可用 `overflowPortalTarget` 指定所属容器，交给另一任务时设 `overflowRestoreFocus=false`；默认取消后回到原入口。

`popupPresentation="bottom"` 让菜单、选择器和带弹层内容的展开按钮从屏幕底部弹出，外壳与“更多”的底部面板相同：菜单项显示为一列触控按钮，单选组的当前值和可勾选项显示为按下状态；选中普通项或单选项后弹层关闭，勾选项保持打开以便连续修改。默认 `anchored` 保持锚定在控件旁的浮层。[EditBar](/raw/components/edit-bar.md) 的编辑栏和面板使用底部呈现。

增加下面的动作并缩小宽度可打开底部面板；勾选“跟随页面尺寸”后，面板打开时旋转仍保持原外壳和正在输入的草稿。自定义表单控件继续通过公共 Field/Input 设置自己的触摸尺寸。

### 示例：toolbar/touch

文件：`touch.vue`

```vue
<script setup lang="ts">
import { computed, ref } from "vue";
import { quireIconRegistry, type QuireKitToolbarEntry } from "@quirekit/ui";
import { QuireCheckbox, QuireIconProvider, QuireSlider, QuireToolbar } from "@quirekit/ui/vue";
import TouchField from "./touch-field.vue";
const bold = ref(false);
const italic = ref(false);
const width = ref([360]), extra = ref(false), automatic = ref(false), draft = ref(""), status = ref("");
const renderers = { note: TouchField };
const context = computed(() => ({ draft: draft.value, update: updateDraft }));
const items = computed<readonly QuireKitToolbarEntry[]>(() => [
  { value: "undo", label: "撤销便签修改", icon: "undo" },
  { value: "redo", label: "重做便签修改", icon: "redo", disabled: true },
  { value: "copy", label: "复制便签", icon: "copy" },
  { value: "save", label: "保存便签", icon: "save" },
  ...(extra.value ? [
    { value: "bold", label: "加粗便签", icon: "bold", kind: "toggle" as const, pressed: bold.value },
    { value: "italic", label: "斜体便签", icon: "italic", kind: "toggle" as const, pressed: italic.value },
    { value: "link", label: "插入链接", icon: "link" },
    { value: "image", label: "插入图片", icon: "image" },
    { value: "note", label: "便签草稿", kind: "custom" as const, renderer: "note" },
    { value: "print", label: "打印便签", icon: "print" },
  ] : []),
]);
/** @param value - Touch action identity. @param pressed - Requested formatting state. */
function toggle(value: string, pressed: boolean): void { if (value === "bold") bold.value = pressed; else italic.value = pressed; }
/** @param value - Unsaved host value; no document command runs while typing. */
function updateDraft(value: string): void { draft.value = value; }
/** @param value - Accepted command identity, whether visible or collapsed. */
function act(value: string): void { status.value = `已执行：${value}`; }
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid gap-qk-group p-qk-surface" data-toolbar-mobile>
      <QuireSlider v-model="width" label="触控工具栏宽度" :min="240" :max="800" :step="20" unit="px" class="max-w-sm" />
      <div class="flex flex-wrap gap-qk-group">
        <QuireCheckbox :checked="extra" label="增加动作" @update:checked="extra = $event === true" />
        <QuireCheckbox :checked="automatic" label="跟随页面尺寸" @update:checked="automatic = $event === true" />
      </div>
      <div class="grid min-h-48 max-w-full grid-cols-[minmax(0,1fr)] grid-rows-[1fr_auto] overflow-hidden rounded-qk-overlay border border-qk-border-subtle bg-qk-surface-page" :style="{ width: `${width[0]}px` }">
        <div class="p-qk-surface">
          <p class="m-0 qk-type-helper text-qk-text-secondary">随手记</p>
          <p :class="{ 'font-bold': bold, italic }">{{ draft || '把今天最重要的想法记下来。' }}</p>
        </div>
        <div class="min-w-0 border-t border-qk-border-subtle bg-qk-surface-overlay p-qk-inline" style="padding-bottom: max(var(--qk-space-inline), env(safe-area-inset-bottom))">
          <QuireToolbar label="触控便签工具" :items="items" :renderers="renderers" :context="context" :mode="automatic ? 'auto' : 'mobile'" overflow="collapse" variant="plain" @toggle="toggle" @select="act" />
        </div>
      </div>
      <p role="status" class="m-0 qk-type-helper text-qk-text-secondary">{{ status || '动作少时全部显示，空间不足时才出现更多。' }}</p>
    </div>
  </QuireIconProvider>
</template>
```

文件：`touch-field.vue`

```vue
<script setup lang="ts">
import { computed } from "vue";
import type { QuireKitToolbarRendererScope } from "@quirekit/ui/vue";
import { QuireInput, QuireToolbarField } from "@quirekit/ui/vue";
const props = defineProps<{
  /** Live host data; the Toolbar never owns this draft. */
  scope: QuireKitToolbarRendererScope;
}>();
/** Draft values belong to this example's host and survive presentation changes. */
interface DraftContext {
  /** Current unsaved input. */
  readonly draft: string;
  /** Updates only the host draft. */
  readonly update: (value: string) => void;
}
const context = computed(() => props.scope.context as DraftContext);
</script>
<template>
  <QuireToolbarField :label="scope.item.label" width="176px">
    <QuireInput :model-value="context.draft" :aria-label="scope.item.label" placeholder="记录一句想法" class="h-44px" @update:model-value="context.update" />
  </QuireToolbarField>
</template>
```

## 控件类型

- Action 立即执行操作。
- Toggle 表示开关状态，也可显示多个对象状态不一致的 `mixed`。
- Selector 把当前值与展开按钮作为一个完整入口。
- Disclosure 打开关联浮层。
- Split Button 分别提供执行当前值和展开其他选项的两个按钮，详见 [Split Button](/raw/components/split-button.md)。

## 键盘操作

工具栏中的按钮共享一个 Tab 停靠点；组合的原生输入字段保留自己的 Tab 行为。按钮横向使用左右方向键，纵向使用上下方向键；Home/End 到达首尾可用按钮。禁用项自动跳过，水平导航自动适应从右向左的界面。

横向滚动时，方向键和 Home/End 会自动揭示获得焦点的控件，不需要先点击滚动箭头。两侧箭头不进入 Toolbar 的命令导航序列，也不增加 Tab 停靠点；点击箭头只滚动，不执行文档动作。RTL 中“向前”朝视觉右侧，“向后”朝视觉左侧。

组合的 Input、Select 及其浮层继续使用各自的键盘约定；输入框中的光标移动不会变成工具栏切换，弹窗里的方向键也不会滚动外层工具栏。

`orientation="vertical"` 切换为纵向导航。Toggle 的模型可使用 `"mixed"` 表示多个值，激活后统一开启。

### 示例：toolbar/vertical

文件：`vertical.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import {
  QuireIcon,
  QuireIconProvider,
  QuireToolbar,
  QuireToolbarAction,
  QuireToolbarToggle
} from "@quirekit/ui/vue";
const bold = ref<boolean | "mixed">("mixed");
const italic = ref(false);
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="flex min-w-0 items-start gap-4 p-qk-surface">
      <QuireToolbar label="侧边格式" orientation="vertical">
        <QuireToolbarAction label="重做格式" disabled>
          <QuireIcon name="redo" />
        </QuireToolbarAction>
        <QuireToolbarToggle v-model="bold" label="统一加粗">
          <QuireIcon name="bold" />
        </QuireToolbarToggle>
        <QuireToolbarToggle v-model="italic" label="统一斜体">
          <QuireIcon name="italic" />
        </QuireToolbarToggle>
      </QuireToolbar>
      <div class="grid min-w-0 gap-2">
        <p class="m-0 text-qk-text-secondary">
          没有可重做的格式。上下方向键跳过禁用项；加粗初始为多个值，激活后统一开启。
        </p>
        <output>
          加粗：{{ bold === "mixed" ? "多个值" : bold ? "开启" : "关闭" }}
        </output>
      </div>
    </div>
  </QuireIconProvider>
</template>
```

## 禁用与提示

Action、Toggle、Selector、Disclosure、ColorPickerDisclosure 与 Split Button 默认使用公共 Tooltip 展示各自的 `label`。配置项和模板组件都用 `tooltip` 覆盖文案、`shortcut` 在提示后附上快捷键、`disabledReason` 说明不可用原因；禁用动作不响应点击、Enter 或 Space。无需再写原生 `title` 或外包 Tooltip。

Split Button 的两侧分别使用 `actionLabel` 与 `disclosureLabel`，可以通过 `actionTooltip` / `disclosureTooltip` 覆盖。主按钮默认插槽只放图标；需要可见文字时使用 `text`，让图标盒、文字与间距由组件统一处理。浮层打开时，对应触发器的 Tooltip 自动关闭。只有提示已经由外层复合控件统一拥有时才使用 `:tooltip="false"`。

## 组合输入字段

Input、Select 与 Combobox 保留各自的输入、选项与键盘规则。将单个字段放在 `QuireToolbarField` 中，并绑定插槽提供的 `size`，即可与工具栏按钮使用相同的紧凑高度、垂直居中和 Tooltip。`width` 给出字段所需的自然宽度；内容溢出时保持该宽度。

```vue
<QuireToolbarField label="字体" width="148px" :expanded="fontMenuOpen">
  <template #default="{ size }">
    <QuireCombobox v-model="font" v-model:open="fontMenuOpen"
      label="字体" :items="fontOptions" :size="size" />
  </template>
</QuireToolbarField>
```

字段值、选项和展开状态由应用提供。禁用时同时向 Field 与实际输入传递 `disabled`，Field 的 `disabledReason` 负责提示原因。原生字段不注册为工具栏按钮，输入框中的光标移动不会触发工具栏切换。

## 浮层组合

Selector 和 Disclosure 可以打开 Menu、Popover 或 Color Picker。打开后，键盘在对应浮层内操作；Escape 关闭浮层并返回展开按钮。

Split Button 的 `overlay="menu"` 放置菜单条目，`overlay="popover"` 放置自定义面板，`disclosure` 插槽可组合 Color Picker 等组件。

示例中的文字颜色使用完整 Color Picker，提供最近使用、预设色板和精确编辑。主按钮应用图标表示的当前颜色；清除颜色后，文字图标保留字母并隐藏色条，按钮名称标识无文字颜色；再次点击主按钮仍执行清除。最近使用列表独立保留，选择其中一个颜色即可重新应用。

### 示例：toolbar/playground

文件：`playground.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { quireIconRegistry } from "@quirekit/ui";
import type { QuireKitToolbarToggleState } from "@quirekit/ui";
import {
  QuireColorPicker,
  QuireIcon,
  QuireIconProvider,
  QuireMenu,
  QuireMenuItem,
  QuireToolbar,
  QuireToolbarAction,
  QuireToolbarColorPickerDisclosure,
  QuireToolbarGroup,
  QuireToolbarSelector,
  QuireToolbarSeparator,
  QuireToolbarSplitButton,
  QuireToolbarToggle
} from "@quirekit/ui/vue";

const bold = ref(false);
const italic = ref<QuireKitToolbarToggleState>("mixed");
const styleMenuOpen = ref(false);
const textStyle = ref("正文");
const colorOpen = ref(false);
const textColor = ref("#3E63DD");
const textReset = ref(false);
const recentColors = ref<readonly string[]>(["#3E63DD", "#E5484D", "#12A594"]);
const lastAction = ref("尚未执行命令");

/** @param label - Human-readable result announced below the toolbar. */
function recordAction(label: string): void {
  lastAction.value = label;
}

/** @param color - Color selected from the shared palette or editor. */
function commitColor(color: string): void {
  recentColors.value = [color, ...recentColors.value.filter(value => value !== color)].slice(0, 10);
  recordAction(`选择文字颜色 ${color}`);
}

/** Applies the visible current state, including an explicit absence of color. */
function applyColor(): void {
  recordAction(textReset.value ? "应用无文字颜色" : `应用文字颜色 ${textColor.value}`);
}
</script>

<template>
  <QuireIconProvider :registry="quireIconRegistry">
    <div class="grid min-w-0 justify-items-start p-qk-surface" data-toolbar-playground>
      <div class="grid min-w-0 max-w-full gap-4">
        <QuireToolbar label="文档格式" class="max-w-full p-qk-inline-tight">
          <QuireToolbarGroup label="历史">
            <QuireToolbarAction label="撤销" @activate="recordAction('撤销')">
              <QuireIcon name="undo" />
            </QuireToolbarAction>
            <QuireToolbarAction label="重做" disabled disabled-reason="没有可重做的操作" @activate="recordAction('重做')">
              <QuireIcon name="redo" />
            </QuireToolbarAction>
          </QuireToolbarGroup>

          <QuireToolbarSeparator />

          <QuireToolbarGroup label="文字格式">
            <QuireToolbarToggle v-model="bold" label="加粗">
              <QuireIcon name="bold" />
            </QuireToolbarToggle>
            <QuireToolbarToggle v-model="italic" label="斜体">
              <QuireIcon name="italic" />
            </QuireToolbarToggle>
          </QuireToolbarGroup>

          <QuireToolbarSeparator />

          <QuireToolbarGroup label="样式">
            <QuireMenu v-model:open="styleMenuOpen" aria-label="段落样式">
              <template #trigger>
                <QuireToolbarSelector :toggle-on-click="false"
                  v-model:expanded="styleMenuOpen"
                  label="段落样式"
                  :text="textStyle"
                />
              </template>
              <QuireMenuItem
                v-for="style in ['正文', '标题 1', '标题 2']"
                :key="style"
                :value="style"
                @select="textStyle = style"
              >
                {{ style }}
              </QuireMenuItem>
            </QuireMenu>

            <QuireToolbarSplitButton
              v-model:expanded="colorOpen"
              label="文字颜色"
              :action-label="textReset ? '应用无文字颜色' : '应用当前文字颜色'"
              disclosure-label="选择文字颜色"
              overlay="custom"
              @action="applyColor"
            >
              <QuireIcon name="textColor" :accent-color="textColor" :empty="textReset" />
              <template #disclosure>
                <QuireColorPicker
                  v-model="textColor" v-model:reset-active="textReset" v-model:open="colorOpen"
                  label="选择文字颜色" :recent-colors="recentColors"
                  @commit="commitColor" @reset="recordAction('已清除文字颜色')"
                >
                  <template #trigger>
                    <QuireToolbarColorPickerDisclosure class="qk-toolbar__split-disclosure" label="选择文字颜色">
                      <QuireIcon name="chevronDown" :size="16" />
                    </QuireToolbarColorPickerDisclosure>
                  </template>
                </QuireColorPicker>
              </template>
            </QuireToolbarSplitButton>
          </QuireToolbarGroup>
        </QuireToolbar>

        <p class="m-0 text-qk-helper text-qk-text-tertiary" aria-live="polite">
          {{ lastAction }} · {{ bold ? "已加粗" : "未加粗" }} · {{ italic === "mixed" ? "斜体多个值" : italic ? "已斜体" : "未斜体" }}
        </p>
      </div>
    </div>
  </QuireIconProvider>
</template>
```

## 自定义控件注册函数

`useQuireToolbarItem` 从 `@quirekit/ui/vue` 导入，在 Toolbar 子组件的 setup 中调用。传入读取当前禁用状态的函数；返回的 `element` 是原生按钮 ref，`id` 是稳定标识，`tabIndex` 是响应式 Tab 停留位置，`handleFocus` 同步焦点。将这些值绑定到同一按钮，并添加 `data-qk-toolbar-item`。

```ts
import type { QuireKitToolbarItemBindings } from '@quirekit/ui/vue'

declare function useQuireToolbarItem(isDisabled: () => boolean): QuireKitToolbarItemBindings
```

Toolbar 之外调用会抛错。普通浮层里的按钮无需注册；能够使用 QuireToolbarAction 等现成控件时，直接使用它们。

## API

### QuireToolbar

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Accessible name announced for the complete toolbar. |
| items | 否 | — | Data entries; the default slot takes precedence. |
| rows | 否 | — | Explicit horizontal rows sharing one surface and focus scope; overrides items/orientation, below the default slot. |
| renderers | 否 | \{\} | Registered custom controls and popup bodies, each receiving a scope prop. |
| context | 否 | — | Host-owned state or services forwarded to custom renderers unchanged. |
| preserveFocus | 否 | false | Preserve host focus on primary mouse presses on toolbar buttons only. |
| variant | 否 | "plain" | Embedded, outlined, or borderless elevated surface. |
| mode | 否 | "desktop" | Desktop (default), touch controls, or owner-document layout media. |
| popupPresentation | 否 | "anchored" | Menus, selectors and popup disclosures open anchored (default) or as bottom sheets. |
| overflowPortalTarget | 否 | — | Owning portal target for the collapsed operation surface. |
| overflowRestoreFocus | 否 | true | Return focus after overflow closes; false when handing control to another task. |
| orientation | 否 | "horizontal" | Layout and keyboard-navigation direction. |
| overflow | 否 | — | Horizontal overflow; vertical toolbars retain their natural layout. |
| scrollbar | 否 | "hidden" | Native horizontal scrollbar presentation. |
| align | 否 | "center" | Inline alignment when the row fits; overflow retains a reachable start. |
| dir | 否 | — | Explicit text direction; inherited CSS direction is used when omitted. |
| loopFocus | 否 | true | Whether arrow-key movement wraps across toolbar edges. |
| id | 否 | — | Optional stable DOM id. |
| sizing | 否 | "natural" | Width model\: natural control widths, or widths in toolbar units (one icon action per unit). |
| unitsPerRow | 否 | — | Row capacity in toolbar units; configured rows wrap when their controls exceed it. |

**label**

```ts
string
```

**items**

```ts
readonly QuireKitToolbarEntry[] | undefined
```

```ts
undefined | readonly ({
  /** Stable identity used in emitted intents and keyed rendering. */
  value: string;
  /** Visible or accessible action name; separator entries may use an empty label. */
  label: string;
  /** Entry behavior; omission means an immediate action. */
  kind?: undefined | "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator";
  /** Provider icon name; without an icon the action displays its label. */
  icon?: undefined | string;
  /** Normalized icon data; takes precedence over a provider icon name. */
  iconData?: undefined | {
    /** Normalized trusted SVG markup rendered by framework adapters. */
    svg: string;
    /** Intrinsic SVG coordinate system retained for audits and previews. */
    viewBox: string;
    /** Source family used to audit licensing and visual consistency. */
    source: "custom" | "lucide" | "tabler";
    /** Upstream or product license identifier for the glyph. */
    license: string;
    /** Whether directional artwork should mirror in right-to-left layouts. */
    mirrorInRtl: boolean;
    /** Centered optical scale used to normalize visually oversized artwork. */
    opticalScale: number;
    /** Number of visible SVG geometry elements in the normalized glyph. */
    complexity: number;
  };
  /** Runtime accent used by stateful artwork such as a current-color underline. */
  iconAccentColor?: string | undefined;
  /** Whether stateful artwork represents an explicitly cleared value. */
  iconEmpty?: boolean | undefined;
  /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
  tooltip?: undefined | string | false;
  /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
  shortcut?: undefined | readonly (string)[];
  /** Explanation shown while this entry is unavailable. */
  disabledReason?: string | undefined;
  /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
  attributes?: undefined | Readonly<Record<`data-${string}`, string | number | boolean | undefined>>;
  /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
  trigger?: undefined | "disclosure" | "selector";
  /** Show the public disclosure indicator; menu disclosures default to true. */
  indicator?: boolean | undefined;
  /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
  popup?: undefined | false | "dialog" | "grid" | "listbox" | "menu" | "tree";
  /** Public floating-surface options for Menu and Popover content. */
  overlayProps?: undefined | {
    /** Owning document's public portal target. */
    portalTarget?: undefined | string | HTMLElement;
    /** Whether an ordinary menu selection closes immediately; controlled hosts may close after success. */
    closeOnSelect?: boolean | undefined;
    /** Menu's fixed content width. */
    width?: undefined | string | number;
    /** Menu's minimum content width. */
    minWidth?: QuireKitMenuLength | undefined;
    /** Menu's maximum content width. */
    maxWidth?: QuireKitMenuLength | undefined;
    /** Host content language and stable application markers. */
    contentAttributes?: undefined | {
      /** Optional application content class. */
      class?: string | undefined;
      /** Language inherited by the floating content. */
      lang?: string | undefined;
      /** Direction inherited by the floating content. */
      dir?: QuireKitToolbarDirection | undefined;
    };
    /** Whether a disclosure or selector popover returns focus to its trigger on close; false when the host hands focus elsewhere. */
    restoreFocus?: boolean | undefined;
  };
  /** Optional text shown next to the icon. */
  text?: string | undefined;
  /** Width in toolbar units, where one unit is an icon action and half units are
allowed. Omitted spans are derived from the entry kind in unit sizing; text
and custom controls keep their natural width unless a span is declared. */
  span?: undefined | number;
  /** Whether activation and roving focus are unavailable. */
  disabled?: boolean | undefined;
  /** Hidden entries are unmounted and excluded from keyboard navigation. */
  hidden?: boolean | undefined;
  /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
  mobile?: boolean | undefined;
  /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
  meta?: unknown;
  /** Default command parameters; custom renderers may supply a different payload. */
  payload?: unknown;
  /** Registry key for an arbitrary custom control using public Toolbar primitives. */
  renderer?: string | undefined;
  /** Registry key for a selector, disclosure, or split button's Popover body. */
  contentRenderer?: string | undefined;
  /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
  contentPadding?: undefined | "default" | "none";
  /** Controlled popup state; omission gives each mounted entry local state. */
  expanded?: boolean | undefined;
  /** Optional accessible description element id. */
  describedBy?: string | undefined;
  /** Split primary action name; defaults to label. */
  actionLabel?: string | undefined;
  /** Split primary explanation; defaults to its action name. */
  actionTooltip?: string | false | undefined;
  /** Split disclosure name; defaults to label. */
  disclosureLabel?: string | undefined;
  /** Split disclosure explanation; defaults to its disclosure name. */
  disclosureTooltip?: string | false | undefined;
  /** Disable only the split primary action. */
  actionDisabled?: boolean | undefined;
  /** Disable only the split disclosure. */
  disclosureDisabled?: boolean | undefined;
  /** Host-owned toggle state, also supported by a split entry primary action. */
  pressed?: undefined | false | true | "mixed";
  /** Ordered children of a semantic group. */
  children?: readonly QuireKitToolbarEntry[] | undefined;
  /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
  items?: undefined | readonly ({
    /** Stable identity emitted for executable rows. */
    value: string;
    /** Localized visible label. */
    label: string;
    /** Group, submenu or ordinary action. */
    kind?: undefined | "group" | "separator" | "item" | "submenu" | "radio-group";
    /** Ordered rows belonging to a group or submenu. */
    children?: readonly QuireKitMenuEntry[] | undefined;
    /** Whether activation is unavailable. */
    disabled?: boolean | undefined;
    /** Optional explanation of an unavailable action. */
    reason?: string | undefined;
    /** Shortcut rendered with Kbd; pass explicit keys for combined shortcuts, or a legacy display string. */
    shortcut?: undefined | string | readonly string[];
    /** Icon name resolved by the current QuireIconProvider. */
    icon?: string | undefined;
    /** Current value of a radio group; its children describe the options. */
    selectedValue?: string | undefined;
    /** Whether activating a leaf closes the menu; checkboxes and radio items default to false. */
    closeOnSelect?: boolean | undefined;
    /** Checked state for a toggle row; omission is an ordinary action. */
    checked?: boolean | undefined;
    /** Visual action emphasis. */
    tone?: undefined | "danger" | "neutral";
  })[];
})[]
```

**rows**

```ts
readonly QuireKitToolbarRow[] | undefined
```

```ts
undefined | readonly ({
  /** Stable row identity, prepended to configured entry event paths. */
  value: string;
  /** Accessible name for this row's semantic group. */
  label: string;
  /** Ordered controls using the same contract as a single-row toolbar. */
  items: readonly ({
    /** Stable identity used in emitted intents and keyed rendering. */
    value: string;
    /** Visible or accessible action name; separator entries may use an empty label. */
    label: string;
    /** Entry behavior; omission means an immediate action. */
    kind?: undefined | "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator";
    /** Provider icon name; without an icon the action displays its label. */
    icon?: undefined | string;
    /** Normalized icon data; takes precedence over a provider icon name. */
    iconData?: undefined | {
      /** Normalized trusted SVG markup rendered by framework adapters. */
      svg: string;
      /** Intrinsic SVG coordinate system retained for audits and previews. */
      viewBox: string;
      /** Source family used to audit licensing and visual consistency. */
      source: QuireKitIconSource;
      /** Upstream or product license identifier for the glyph. */
      license: string;
      /** Whether directional artwork should mirror in right-to-left layouts. */
      mirrorInRtl: boolean;
      /** Centered optical scale used to normalize visually oversized artwork. */
      opticalScale: number;
      /** Number of visible SVG geometry elements in the normalized glyph. */
      complexity: number;
    };
    /** Runtime accent used by stateful artwork such as a current-color underline. */
    iconAccentColor?: string | undefined;
    /** Whether stateful artwork represents an explicitly cleared value. */
    iconEmpty?: boolean | undefined;
    /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
    tooltip?: undefined | string | false;
    /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
    shortcut?: undefined | readonly (string)[];
    /** Explanation shown while this entry is unavailable. */
    disabledReason?: string | undefined;
    /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
    attributes?: undefined | Readonly<Record<`data-${string}`, string | number | boolean | undefined>>;
    /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
    trigger?: undefined | "disclosure" | "selector";
    /** Show the public disclosure indicator; menu disclosures default to true. */
    indicator?: boolean | undefined;
    /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
    popup?: undefined | false | "dialog" | "grid" | "listbox" | "menu" | "tree";
    /** Public floating-surface options for Menu and Popover content. */
    overlayProps?: undefined | {
      /** Owning document's public portal target. */
      portalTarget?: string | HTMLElement | undefined;
      /** Whether an ordinary menu selection closes immediately; controlled hosts may close after success. */
      closeOnSelect?: boolean | undefined;
      /** Menu's fixed content width. */
      width?: QuireKitMenuLength | undefined;
      /** Menu's minimum content width. */
      minWidth?: QuireKitMenuLength | undefined;
      /** Menu's maximum content width. */
      maxWidth?: QuireKitMenuLength | undefined;
      /** Host content language and stable application markers. */
      contentAttributes?: QuireKitToolbarContentAttributes | undefined;
      /** Whether a disclosure or selector popover returns focus to its trigger on close; false when the host hands focus elsewhere. */
      restoreFocus?: boolean | undefined;
    };
    /** Optional text shown next to the icon. */
    text?: string | undefined;
    /** Width in toolbar units, where one unit is an icon action and half units are
  allowed. Omitted spans are derived from the entry kind in unit sizing; text
  and custom controls keep their natural width unless a span is declared. */
    span?: undefined | number;
    /** Whether activation and roving focus are unavailable. */
    disabled?: boolean | undefined;
    /** Hidden entries are unmounted and excluded from keyboard navigation. */
    hidden?: boolean | undefined;
    /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
  desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
    mobile?: boolean | undefined;
    /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
    meta?: unknown;
    /** Default command parameters; custom renderers may supply a different payload. */
    payload?: unknown;
    /** Registry key for an arbitrary custom control using public Toolbar primitives. */
    renderer?: string | undefined;
    /** Registry key for a selector, disclosure, or split button's Popover body. */
    contentRenderer?: string | undefined;
    /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
    contentPadding?: undefined | "default" | "none";
    /** Controlled popup state; omission gives each mounted entry local state. */
    expanded?: boolean | undefined;
    /** Optional accessible description element id. */
    describedBy?: string | undefined;
    /** Split primary action name; defaults to label. */
    actionLabel?: string | undefined;
    /** Split primary explanation; defaults to its action name. */
    actionTooltip?: string | false | undefined;
    /** Split disclosure name; defaults to label. */
    disclosureLabel?: string | undefined;
    /** Split disclosure explanation; defaults to its disclosure name. */
    disclosureTooltip?: string | false | undefined;
    /** Disable only the split primary action. */
    actionDisabled?: boolean | undefined;
    /** Disable only the split disclosure. */
    disclosureDisabled?: boolean | undefined;
    /** Host-owned toggle state, also supported by a split entry primary action. */
    pressed?: undefined | false | true | "mixed";
    /** Ordered children of a semantic group. */
    children?: undefined | readonly QuireKitToolbarEntry[];
    /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
    items?: undefined | readonly ({
      /** Stable identity emitted for executable rows. */
      value: string;
      /** Localized visible label. */
      label: string;
      /** Group, submenu or ordinary action. */
      kind?: "group" | "separator" | "item" | "submenu" | "radio-group" | undefined;
      /** Ordered rows belonging to a group or submenu. */
      children?: readonly QuireKitMenuEntry[] | undefined;
      /** Whether activation is unavailable. */
      disabled?: boolean | undefined;
      /** Optional explanation of an unavailable action. */
      reason?: string | undefined;
      /** Shortcut rendered with Kbd; pass explicit keys for combined shortcuts, or a legacy display string. */
      shortcut?: string | readonly string[] | undefined;
      /** Icon name resolved by the current QuireIconProvider. */
      icon?: string | undefined;
      /** Current value of a radio group; its children describe the options. */
      selectedValue?: string | undefined;
      /** Whether activating a leaf closes the menu; checkboxes and radio items default to false. */
      closeOnSelect?: boolean | undefined;
      /** Checked state for a toggle row; omission is an ordinary action. */
      checked?: boolean | undefined;
      /** Visual action emphasis. */
      tone?: QuireKitMenuItemTone | undefined;
    })[];
  })[];
  /** Exclude the row from layout and keyboard navigation. */
  hidden?: boolean | undefined;
  /** Inherited availability for every control in this row. */
  disabled?: boolean | undefined;
})[]
```

**renderers**

```ts
Readonly<Record<string, Component>> | undefined
```

```ts
undefined | Readonly<Record<string, Component>>
```

**context**

```ts
unknown
```

**preserveFocus**

```ts
boolean | undefined
```

**variant**

```ts
QuireKitToolbarVariant | undefined
```

```ts
undefined | "plain" | "outlined" | "elevated"
```

**mode**

```ts
QuireKitToolbarMode | undefined
```

```ts
undefined | "auto" | "desktop" | "mobile"
```

**popupPresentation**

```ts
QuireKitToolbarPopupPresentation | undefined
```

```ts
undefined | "bottom" | "anchored"
```

**overflowPortalTarget**

```ts
string | HTMLElement | undefined
```

```ts
undefined | string | HTMLElement
```

**overflowRestoreFocus**

```ts
boolean | undefined
```

**orientation**

```ts
QuireKitToolbarOrientation | undefined
```

```ts
undefined | "vertical" | "horizontal"
```

**overflow**

```ts
QuireKitToolbarOverflow | undefined
```

```ts
undefined | "scroll" | "collapse" | "visible"
```

**scrollbar**

```ts
QuireKitToolbarScrollbar | undefined
```

```ts
undefined | "auto" | "hidden"
```

**align**

```ts
QuireKitToolbarAlignment | undefined
```

```ts
undefined | "start" | "center"
```

**dir**

```ts
QuireKitToolbarDirection | undefined
```

```ts
undefined | "ltr" | "rtl"
```

**loopFocus**

```ts
boolean | undefined
```

**id**

```ts
string | undefined
```

```ts
undefined | string
```

**sizing**

```ts
QuireKitToolbarSizing | undefined
```

```ts
undefined | "natural" | "units"
```

**unitsPerRow**

```ts
number | undefined
```

```ts
undefined | number
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| openChange | 否 | — |  |
| execute | 否 | — |  |
| overflowOpenChange | 否 | — |  |
| overflowContentElementChange | 否 | — |  |
| select | 否 | — |  |
| toggle | 否 | — |  |

**openChange**

```ts
[event: QuireKitToolbarOpenChangeEvent]
```

**execute**

```ts
[event: QuireKitToolbarExecuteEvent]
```

**overflowOpenChange**

```ts
[open: boolean, trigger: HTMLElement | null]
```

**overflowContentElementChange**

```ts
[element: HTMLElement | null]
```

**select**

```ts
[value: string]
```

**toggle**

```ts
[value: string, pressed: boolean]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | Toolbar groups, actions, toggles, disclosures, and separators. |
| item | 否 | — | Custom entries preserve public toolbar primitive composition. |
| content | 否 | — | Fallback body for configured selector, disclosure and split popovers. |

**default**

```ts
any
```

**item**

```ts
QuireKitToolbarRendererScope
```

```ts
{
  /** Current entry including host metadata and parameters. */
  item: {
    /** Stable identity used in emitted intents and keyed rendering. */
    value: string;
    /** Visible or accessible action name; separator entries may use an empty label. */
    label: string;
    /** Entry behavior; omission means an immediate action. */
    kind?: undefined | "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator";
    /** Provider icon name; without an icon the action displays its label. */
    icon?: undefined | string;
    /** Normalized icon data; takes precedence over a provider icon name. */
    iconData?: undefined | {
      /** Normalized trusted SVG markup rendered by framework adapters. */
      svg: string;
      /** Intrinsic SVG coordinate system retained for audits and previews. */
      viewBox: string;
      /** Source family used to audit licensing and visual consistency. */
      source: QuireKitIconSource;
      /** Upstream or product license identifier for the glyph. */
      license: string;
      /** Whether directional artwork should mirror in right-to-left layouts. */
      mirrorInRtl: boolean;
      /** Centered optical scale used to normalize visually oversized artwork. */
      opticalScale: number;
      /** Number of visible SVG geometry elements in the normalized glyph. */
      complexity: number;
    };
    /** Runtime accent used by stateful artwork such as a current-color underline. */
    iconAccentColor?: string | undefined;
    /** Whether stateful artwork represents an explicitly cleared value. */
    iconEmpty?: boolean | undefined;
    /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
    tooltip?: undefined | string | false;
    /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
    shortcut?: undefined | readonly (string)[];
    /** Explanation shown while this entry is unavailable. */
    disabledReason?: string | undefined;
    /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
    attributes?: undefined | Readonly<Record<`data-${string}`, string | number | boolean | undefined>>;
    /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
    trigger?: undefined | "disclosure" | "selector";
    /** Show the public disclosure indicator; menu disclosures default to true. */
    indicator?: boolean | undefined;
    /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
    popup?: undefined | false | "dialog" | "grid" | "listbox" | "menu" | "tree";
    /** Public floating-surface options for Menu and Popover content. */
    overlayProps?: undefined | {
      /** Owning document's public portal target. */
      portalTarget?: string | HTMLElement | undefined;
      /** Whether an ordinary menu selection closes immediately; controlled hosts may close after success. */
      closeOnSelect?: boolean | undefined;
      /** Menu's fixed content width. */
      width?: QuireKitMenuLength | undefined;
      /** Menu's minimum content width. */
      minWidth?: QuireKitMenuLength | undefined;
      /** Menu's maximum content width. */
      maxWidth?: QuireKitMenuLength | undefined;
      /** Host content language and stable application markers. */
      contentAttributes?: QuireKitToolbarContentAttributes | undefined;
      /** Whether a disclosure or selector popover returns focus to its trigger on close; false when the host hands focus elsewhere. */
      restoreFocus?: boolean | undefined;
    };
    /** Optional text shown next to the icon. */
    text?: string | undefined;
    /** Width in toolbar units, where one unit is an icon action and half units are
  allowed. Omitted spans are derived from the entry kind in unit sizing; text
  and custom controls keep their natural width unless a span is declared. */
    span?: undefined | number;
    /** Whether activation and roving focus are unavailable. */
    disabled?: boolean | undefined;
    /** Hidden entries are unmounted and excluded from keyboard navigation. */
    hidden?: boolean | undefined;
    /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
  desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
    mobile?: boolean | undefined;
    /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
    meta?: unknown;
    /** Default command parameters; custom renderers may supply a different payload. */
    payload?: unknown;
    /** Registry key for an arbitrary custom control using public Toolbar primitives. */
    renderer?: string | undefined;
    /** Registry key for a selector, disclosure, or split button's Popover body. */
    contentRenderer?: string | undefined;
    /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
    contentPadding?: undefined | "default" | "none";
    /** Controlled popup state; omission gives each mounted entry local state. */
    expanded?: boolean | undefined;
    /** Optional accessible description element id. */
    describedBy?: string | undefined;
    /** Split primary action name; defaults to label. */
    actionLabel?: string | undefined;
    /** Split primary explanation; defaults to its action name. */
    actionTooltip?: string | false | undefined;
    /** Split disclosure name; defaults to label. */
    disclosureLabel?: string | undefined;
    /** Split disclosure explanation; defaults to its disclosure name. */
    disclosureTooltip?: string | false | undefined;
    /** Disable only the split primary action. */
    actionDisabled?: boolean | undefined;
    /** Disable only the split disclosure. */
    disclosureDisabled?: boolean | undefined;
    /** Host-owned toggle state, also supported by a split entry primary action. */
    pressed?: undefined | false | true | "mixed";
    /** Ordered children of a semantic group. */
    children?: undefined | readonly (QuireKitToolbarEntry)[];
    /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
    items?: undefined | readonly ({
      /** Stable identity emitted for executable rows. */
      value: string;
      /** Localized visible label. */
      label: string;
      /** Group, submenu or ordinary action. */
      kind?: "group" | "separator" | "item" | "submenu" | "radio-group" | undefined;
      /** Ordered rows belonging to a group or submenu. */
      children?: readonly QuireKitMenuEntry[] | undefined;
      /** Whether activation is unavailable. */
      disabled?: boolean | undefined;
      /** Optional explanation of an unavailable action. */
      reason?: string | undefined;
      /** Shortcut rendered with Kbd; pass explicit keys for combined shortcuts, or a legacy display string. */
      shortcut?: string | readonly string[] | undefined;
      /** Icon name resolved by the current QuireIconProvider. */
      icon?: string | undefined;
      /** Current value of a radio group; its children describe the options. */
      selectedValue?: string | undefined;
      /** Whether activating a leaf closes the menu; checkboxes and radio items default to false. */
      closeOnSelect?: boolean | undefined;
      /** Checked state for a toggle row; omission is an ordinary action. */
      checked?: boolean | undefined;
      /** Visual action emphasis. */
      tone?: QuireKitMenuItemTone | undefined;
    })[];
  };
  /** Stable ancestry within the configured toolbar. */
  path: readonly string[];
  /** Host-owned state snapshot or services; Toolbar never interprets it. */
  context: unknown;
  /** Effective availability, including enclosing groups. */
  disabled: boolean;
  /** Current popup state. */
  expanded: boolean;
  /** Request a popup transition. */
  setExpanded: { (expanded: boolean): void; };
  /** Request execution. */
  execute: { (payload?: unknown, nativeEvent?: Event | undefined): void; };
}
```

**content**

```ts
QuireKitToolbarRendererScope
```

```ts
{
  /** Current entry including host metadata and parameters. */
  item: {
    /** Stable identity used in emitted intents and keyed rendering. */
    value: string;
    /** Visible or accessible action name; separator entries may use an empty label. */
    label: string;
    /** Entry behavior; omission means an immediate action. */
    kind?: undefined | "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator";
    /** Provider icon name; without an icon the action displays its label. */
    icon?: undefined | string;
    /** Normalized icon data; takes precedence over a provider icon name. */
    iconData?: undefined | {
      /** Normalized trusted SVG markup rendered by framework adapters. */
      svg: string;
      /** Intrinsic SVG coordinate system retained for audits and previews. */
      viewBox: string;
      /** Source family used to audit licensing and visual consistency. */
      source: QuireKitIconSource;
      /** Upstream or product license identifier for the glyph. */
      license: string;
      /** Whether directional artwork should mirror in right-to-left layouts. */
      mirrorInRtl: boolean;
      /** Centered optical scale used to normalize visually oversized artwork. */
      opticalScale: number;
      /** Number of visible SVG geometry elements in the normalized glyph. */
      complexity: number;
    };
    /** Runtime accent used by stateful artwork such as a current-color underline. */
    iconAccentColor?: string | undefined;
    /** Whether stateful artwork represents an explicitly cleared value. */
    iconEmpty?: boolean | undefined;
    /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
    tooltip?: undefined | string | false;
    /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
    shortcut?: undefined | readonly (string)[];
    /** Explanation shown while this entry is unavailable. */
    disabledReason?: string | undefined;
    /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
    attributes?: undefined | Readonly<Record<`data-${string}`, string | number | boolean | undefined>>;
    /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
    trigger?: undefined | "disclosure" | "selector";
    /** Show the public disclosure indicator; menu disclosures default to true. */
    indicator?: boolean | undefined;
    /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
    popup?: undefined | false | "dialog" | "grid" | "listbox" | "menu" | "tree";
    /** Public floating-surface options for Menu and Popover content. */
    overlayProps?: undefined | {
      /** Owning document's public portal target. */
      portalTarget?: string | HTMLElement | undefined;
      /** Whether an ordinary menu selection closes immediately; controlled hosts may close after success. */
      closeOnSelect?: boolean | undefined;
      /** Menu's fixed content width. */
      width?: QuireKitMenuLength | undefined;
      /** Menu's minimum content width. */
      minWidth?: QuireKitMenuLength | undefined;
      /** Menu's maximum content width. */
      maxWidth?: QuireKitMenuLength | undefined;
      /** Host content language and stable application markers. */
      contentAttributes?: QuireKitToolbarContentAttributes | undefined;
      /** Whether a disclosure or selector popover returns focus to its trigger on close; false when the host hands focus elsewhere. */
      restoreFocus?: boolean | undefined;
    };
    /** Optional text shown next to the icon. */
    text?: string | undefined;
    /** Width in toolbar units, where one unit is an icon action and half units are
  allowed. Omitted spans are derived from the entry kind in unit sizing; text
  and custom controls keep their natural width unless a span is declared. */
    span?: undefined | number;
    /** Whether activation and roving focus are unavailable. */
    disabled?: boolean | undefined;
    /** Hidden entries are unmounted and excluded from keyboard navigation. */
    hidden?: boolean | undefined;
    /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
  desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
    mobile?: boolean | undefined;
    /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
    meta?: unknown;
    /** Default command parameters; custom renderers may supply a different payload. */
    payload?: unknown;
    /** Registry key for an arbitrary custom control using public Toolbar primitives. */
    renderer?: string | undefined;
    /** Registry key for a selector, disclosure, or split button's Popover body. */
    contentRenderer?: string | undefined;
    /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
    contentPadding?: undefined | "default" | "none";
    /** Controlled popup state; omission gives each mounted entry local state. */
    expanded?: boolean | undefined;
    /** Optional accessible description element id. */
    describedBy?: string | undefined;
    /** Split primary action name; defaults to label. */
    actionLabel?: string | undefined;
    /** Split primary explanation; defaults to its action name. */
    actionTooltip?: string | false | undefined;
    /** Split disclosure name; defaults to label. */
    disclosureLabel?: string | undefined;
    /** Split disclosure explanation; defaults to its disclosure name. */
    disclosureTooltip?: string | false | undefined;
    /** Disable only the split primary action. */
    actionDisabled?: boolean | undefined;
    /** Disable only the split disclosure. */
    disclosureDisabled?: boolean | undefined;
    /** Host-owned toggle state, also supported by a split entry primary action. */
    pressed?: undefined | false | true | "mixed";
    /** Ordered children of a semantic group. */
    children?: undefined | readonly (QuireKitToolbarEntry)[];
    /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
    items?: undefined | readonly ({
      /** Stable identity emitted for executable rows. */
      value: string;
      /** Localized visible label. */
      label: string;
      /** Group, submenu or ordinary action. */
      kind?: "group" | "separator" | "item" | "submenu" | "radio-group" | undefined;
      /** Ordered rows belonging to a group or submenu. */
      children?: readonly QuireKitMenuEntry[] | undefined;
      /** Whether activation is unavailable. */
      disabled?: boolean | undefined;
      /** Optional explanation of an unavailable action. */
      reason?: string | undefined;
      /** Shortcut rendered with Kbd; pass explicit keys for combined shortcuts, or a legacy display string. */
      shortcut?: string | readonly string[] | undefined;
      /** Icon name resolved by the current QuireIconProvider. */
      icon?: string | undefined;
      /** Current value of a radio group; its children describe the options. */
      selectedValue?: string | undefined;
      /** Whether activating a leaf closes the menu; checkboxes and radio items default to false. */
      closeOnSelect?: boolean | undefined;
      /** Checked state for a toggle row; omission is an ordinary action. */
      checked?: boolean | undefined;
      /** Visual action emphasis. */
      tone?: QuireKitMenuItemTone | undefined;
    })[];
  };
  /** Stable ancestry within the configured toolbar. */
  path: readonly string[];
  /** Host-owned state snapshot or services; Toolbar never interprets it. */
  context: unknown;
  /** Effective availability, including enclosing groups. */
  disabled: boolean;
  /** Current popup state. */
  expanded: boolean;
  /** Request a popup transition. */
  setExpanded: { (expanded: boolean): void; };
  /** Request execution. */
  execute: { (payload?: unknown, nativeEvent?: Event | undefined): void; };
}
```

#### 公开实例成员

无。

#### 相关类型

```ts
type QuireKitToolbarEntry = {
  /** Stable identity used in emitted intents and keyed rendering. */
  value: string;
  /** Visible or accessible action name; separator entries may use an empty label. */
  label: string;
  /** Entry behavior; omission means an immediate action. */
  kind?: undefined | "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator";
  /** Provider icon name; without an icon the action displays its label. */
  icon?: undefined | string;
  /** Normalized icon data; takes precedence over a provider icon name. */
  iconData?: undefined | {
    /** Normalized trusted SVG markup rendered by framework adapters. */
    svg: string;
    /** Intrinsic SVG coordinate system retained for audits and previews. */
    viewBox: string;
    /** Source family used to audit licensing and visual consistency. */
    source: QuireKitIconSource;
    /** Upstream or product license identifier for the glyph. */
    license: string;
    /** Whether directional artwork should mirror in right-to-left layouts. */
    mirrorInRtl: boolean;
    /** Centered optical scale used to normalize visually oversized artwork. */
    opticalScale: number;
    /** Number of visible SVG geometry elements in the normalized glyph. */
    complexity: number;
  };
  /** Runtime accent used by stateful artwork such as a current-color underline. */
  iconAccentColor?: string | undefined;
  /** Whether stateful artwork represents an explicitly cleared value. */
  iconEmpty?: boolean | undefined;
  /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
  tooltip?: undefined | string | false;
  /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
  shortcut?: undefined | readonly (string)[];
  /** Explanation shown while this entry is unavailable. */
  disabledReason?: string | undefined;
  /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
  attributes?: undefined | Readonly<Record<`data-${string}`, string | number | boolean | undefined>>;
  /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
  trigger?: undefined | "disclosure" | "selector";
  /** Show the public disclosure indicator; menu disclosures default to true. */
  indicator?: boolean | undefined;
  /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
  popup?: undefined | false | "dialog" | "grid" | "listbox" | "menu" | "tree";
  /** Public floating-surface options for Menu and Popover content. */
  overlayProps?: undefined | {
    /** Owning document's public portal target. */
    portalTarget?: string | HTMLElement | undefined;
    /** Whether an ordinary menu selection closes immediately; controlled hosts may close after success. */
    closeOnSelect?: boolean | undefined;
    /** Menu's fixed content width. */
    width?: QuireKitMenuLength | undefined;
    /** Menu's minimum content width. */
    minWidth?: QuireKitMenuLength | undefined;
    /** Menu's maximum content width. */
    maxWidth?: QuireKitMenuLength | undefined;
    /** Host content language and stable application markers. */
    contentAttributes?: QuireKitToolbarContentAttributes | undefined;
    /** Whether a disclosure or selector popover returns focus to its trigger on close; false when the host hands focus elsewhere. */
    restoreFocus?: boolean | undefined;
  };
  /** Optional text shown next to the icon. */
  text?: string | undefined;
  /** Width in toolbar units, where one unit is an icon action and half units are
allowed. Omitted spans are derived from the entry kind in unit sizing; text
and custom controls keep their natural width unless a span is declared. */
  span?: undefined | number;
  /** Whether activation and roving focus are unavailable. */
  disabled?: boolean | undefined;
  /** Hidden entries are unmounted and excluded from keyboard navigation. */
  hidden?: boolean | undefined;
  /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
  mobile?: boolean | undefined;
  /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
  meta?: unknown;
  /** Default command parameters; custom renderers may supply a different payload. */
  payload?: unknown;
  /** Registry key for an arbitrary custom control using public Toolbar primitives. */
  renderer?: string | undefined;
  /** Registry key for a selector, disclosure, or split button's Popover body. */
  contentRenderer?: string | undefined;
  /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
  contentPadding?: undefined | "default" | "none";
  /** Controlled popup state; omission gives each mounted entry local state. */
  expanded?: boolean | undefined;
  /** Optional accessible description element id. */
  describedBy?: string | undefined;
  /** Split primary action name; defaults to label. */
  actionLabel?: string | undefined;
  /** Split primary explanation; defaults to its action name. */
  actionTooltip?: string | false | undefined;
  /** Split disclosure name; defaults to label. */
  disclosureLabel?: string | undefined;
  /** Split disclosure explanation; defaults to its disclosure name. */
  disclosureTooltip?: string | false | undefined;
  /** Disable only the split primary action. */
  actionDisabled?: boolean | undefined;
  /** Disable only the split disclosure. */
  disclosureDisabled?: boolean | undefined;
  /** Host-owned toggle state, also supported by a split entry primary action. */
  pressed?: undefined | false | true | "mixed";
  /** Ordered children of a semantic group. */
  children?: undefined | readonly (QuireKitToolbarEntry)[];
  /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
  items?: undefined | readonly ({
    /** Stable identity emitted for executable rows. */
    value: string;
    /** Localized visible label. */
    label: string;
    /** Group, submenu or ordinary action. */
    kind?: "group" | "separator" | "item" | "submenu" | "radio-group" | undefined;
    /** Ordered rows belonging to a group or submenu. */
    children?: readonly QuireKitMenuEntry[] | undefined;
    /** Whether activation is unavailable. */
    disabled?: boolean | undefined;
    /** Optional explanation of an unavailable action. */
    reason?: string | undefined;
    /** Shortcut rendered with Kbd; pass explicit keys for combined shortcuts, or a legacy display string. */
    shortcut?: string | readonly string[] | undefined;
    /** Icon name resolved by the current QuireIconProvider. */
    icon?: string | undefined;
    /** Current value of a radio group; its children describe the options. */
    selectedValue?: string | undefined;
    /** Whether activating a leaf closes the menu; checkboxes and radio items default to false. */
    closeOnSelect?: boolean | undefined;
    /** Checked state for a toggle row; omission is an ordinary action. */
    checked?: boolean | undefined;
    /** Visual action emphasis. */
    tone?: QuireKitMenuItemTone | undefined;
  })[];
};
```

```ts
type QuireKitIconData = {
  /** Normalized trusted SVG markup rendered by framework adapters. */
  svg: string;
  /** Intrinsic SVG coordinate system retained for audits and previews. */
  viewBox: string;
  /** Source family used to audit licensing and visual consistency. */
  source: "custom" | "lucide" | "tabler";
  /** Upstream or product license identifier for the glyph. */
  license: string;
  /** Whether directional artwork should mirror in right-to-left layouts. */
  mirrorInRtl: boolean;
  /** Centered optical scale used to normalize visually oversized artwork. */
  opticalScale: number;
  /** Number of visible SVG geometry elements in the normalized glyph. */
  complexity: number;
};
```

```ts
type QuireKitIconSource = "custom" | "lucide" | "tabler";
```

```ts
type QuireKitToolbarOverlayProps = {
  /** Owning document's public portal target. */
  portalTarget?: undefined | string | HTMLElement;
  /** Whether an ordinary menu selection closes immediately; controlled hosts may close after success. */
  closeOnSelect?: boolean | undefined;
  /** Menu's fixed content width. */
  width?: undefined | string | number;
  /** Menu's minimum content width. */
  minWidth?: QuireKitMenuLength | undefined;
  /** Menu's maximum content width. */
  maxWidth?: QuireKitMenuLength | undefined;
  /** Host content language and stable application markers. */
  contentAttributes?: undefined | {
    /** Optional application content class. */
    class?: string | undefined;
    /** Language inherited by the floating content. */
    lang?: string | undefined;
    /** Direction inherited by the floating content. */
    dir?: QuireKitToolbarDirection | undefined;
  };
  /** Whether a disclosure or selector popover returns focus to its trigger on close; false when the host hands focus elsewhere. */
  restoreFocus?: boolean | undefined;
};
```

```ts
type QuireKitToolbarContentAttributes = {
  /** Optional application content class. */
  class?: string | undefined;
  /** Language inherited by the floating content. */
  lang?: string | undefined;
  /** Direction inherited by the floating content. */
  dir?: undefined | "ltr" | "rtl";
};
```

```ts
type QuireKitMenuEntry = {
  /** Stable identity emitted for executable rows. */
  value: string;
  /** Localized visible label. */
  label: string;
  /** Group, submenu or ordinary action. */
  kind?: undefined | "group" | "separator" | "item" | "submenu" | "radio-group";
  /** Ordered rows belonging to a group or submenu. */
  children?: readonly QuireKitMenuEntry[] | undefined;
  /** Whether activation is unavailable. */
  disabled?: boolean | undefined;
  /** Optional explanation of an unavailable action. */
  reason?: string | undefined;
  /** Shortcut rendered with Kbd; pass explicit keys for combined shortcuts, or a legacy display string. */
  shortcut?: undefined | string | readonly string[];
  /** Icon name resolved by the current QuireIconProvider. */
  icon?: string | undefined;
  /** Current value of a radio group; its children describe the options. */
  selectedValue?: string | undefined;
  /** Whether activating a leaf closes the menu; checkboxes and radio items default to false. */
  closeOnSelect?: boolean | undefined;
  /** Checked state for a toggle row; omission is an ordinary action. */
  checked?: boolean | undefined;
  /** Visual action emphasis. */
  tone?: undefined | "danger" | "neutral";
};
```

```ts
type QuireKitToolbarRow = {
  /** Stable row identity, prepended to configured entry event paths. */
  value: string;
  /** Accessible name for this row's semantic group. */
  label: string;
  /** Ordered controls using the same contract as a single-row toolbar. */
  items: readonly ({
    /** Stable identity used in emitted intents and keyed rendering. */
    value: string;
    /** Visible or accessible action name; separator entries may use an empty label. */
    label: string;
    /** Entry behavior; omission means an immediate action. */
    kind?: "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator" | undefined;
    /** Provider icon name; without an icon the action displays its label. */
    icon?: string | undefined;
    /** Normalized icon data; takes precedence over a provider icon name. */
    iconData?: QuireKitIconData | undefined;
    /** Runtime accent used by stateful artwork such as a current-color underline. */
    iconAccentColor?: string | undefined;
    /** Whether stateful artwork represents an explicitly cleared value. */
    iconEmpty?: boolean | undefined;
    /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
    tooltip?: string | false | undefined;
    /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
    shortcut?: readonly string[] | undefined;
    /** Explanation shown while this entry is unavailable. */
    disabledReason?: string | undefined;
    /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
    attributes?: Readonly<Record<`data-${string}`, string | number | boolean | undefined>> | undefined;
    /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
    trigger?: "disclosure" | "selector" | undefined;
    /** Show the public disclosure indicator; menu disclosures default to true. */
    indicator?: boolean | undefined;
    /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
    popup?: false | QuireKitToolbarPopup | undefined;
    /** Public floating-surface options for Menu and Popover content. */
    overlayProps?: QuireKitToolbarOverlayProps | undefined;
    /** Optional text shown next to the icon. */
    text?: string | undefined;
    /** Width in toolbar units, where one unit is an icon action and half units are
  allowed. Omitted spans are derived from the entry kind in unit sizing; text
  and custom controls keep their natural width unless a span is declared. */
    span?: number | undefined;
    /** Whether activation and roving focus are unavailable. */
    disabled?: boolean | undefined;
    /** Hidden entries are unmounted and excluded from keyboard navigation. */
    hidden?: boolean | undefined;
    /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
  desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
    mobile?: boolean | undefined;
    /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
    meta?: unknown;
    /** Default command parameters; custom renderers may supply a different payload. */
    payload?: unknown;
    /** Registry key for an arbitrary custom control using public Toolbar primitives. */
    renderer?: string | undefined;
    /** Registry key for a selector, disclosure, or split button's Popover body. */
    contentRenderer?: string | undefined;
    /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
    contentPadding?: "default" | "none" | undefined;
    /** Controlled popup state; omission gives each mounted entry local state. */
    expanded?: boolean | undefined;
    /** Optional accessible description element id. */
    describedBy?: string | undefined;
    /** Split primary action name; defaults to label. */
    actionLabel?: string | undefined;
    /** Split primary explanation; defaults to its action name. */
    actionTooltip?: string | false | undefined;
    /** Split disclosure name; defaults to label. */
    disclosureLabel?: string | undefined;
    /** Split disclosure explanation; defaults to its disclosure name. */
    disclosureTooltip?: string | false | undefined;
    /** Disable only the split primary action. */
    actionDisabled?: boolean | undefined;
    /** Disable only the split disclosure. */
    disclosureDisabled?: boolean | undefined;
    /** Host-owned toggle state, also supported by a split entry primary action. */
    pressed?: QuireKitToolbarToggleState | undefined;
    /** Ordered children of a semantic group. */
    children?: readonly QuireKitToolbarEntry[] | undefined;
    /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
    items?: readonly QuireKitMenuEntry[] | undefined;
  })[];
  /** Exclude the row from layout and keyboard navigation. */
  hidden?: boolean | undefined;
  /** Inherited availability for every control in this row. */
  disabled?: boolean | undefined;
};
```

```ts
type QuireKitToolbarRendererScope = {
  /** Current entry including host metadata and parameters. */
  item: {
    /** Stable identity used in emitted intents and keyed rendering. */
    value: string;
    /** Visible or accessible action name; separator entries may use an empty label. */
    label: string;
    /** Entry behavior; omission means an immediate action. */
    kind?: "custom" | "action" | "menu" | "disclosure" | "toggle" | "selector" | "split" | "group" | "separator" | undefined;
    /** Provider icon name; without an icon the action displays its label. */
    icon?: string | undefined;
    /** Normalized icon data; takes precedence over a provider icon name. */
    iconData?: QuireKitIconData | undefined;
    /** Runtime accent used by stateful artwork such as a current-color underline. */
    iconAccentColor?: string | undefined;
    /** Whether stateful artwork represents an explicitly cleared value. */
    iconEmpty?: boolean | undefined;
    /** Tooltip explanation; defaults to label. False is for an enclosing compound tooltip owner. */
    tooltip?: string | false | undefined;
    /** Keyboard shortcut shown in the tooltip, in reading order such as `["⌘", "B"]`; display only, never registered. */
    shortcut?: readonly string[] | undefined;
    /** Explanation shown while this entry is unavailable. */
    disabledReason?: string | undefined;
    /** Native trigger data attributes; keyboard and interaction properties remain component-owned. */
    attributes?: Readonly<Record<`data-${string}`, string | number | boolean | undefined>> | undefined;
    /** Menu trigger appearance; selector displays a current value, disclosure represents an operation. */
    trigger?: "disclosure" | "selector" | undefined;
    /** Show the public disclosure indicator; menu disclosures default to true. */
    indicator?: boolean | undefined;
    /** Disclosure or custom-control popup semantics; false represents a persistent external panel. */
    popup?: false | QuireKitToolbarPopup | undefined;
    /** Public floating-surface options for Menu and Popover content. */
    overlayProps?: QuireKitToolbarOverlayProps | undefined;
    /** Optional text shown next to the icon. */
    text?: string | undefined;
    /** Width in toolbar units, where one unit is an icon action and half units are
  allowed. Omitted spans are derived from the entry kind in unit sizing; text
  and custom controls keep their natural width unless a span is declared. */
    span?: number | undefined;
    /** Whether activation and roving focus are unavailable. */
    disabled?: boolean | undefined;
    /** Hidden entries are unmounted and excluded from keyboard navigation. */
    hidden?: boolean | undefined;
    /** Whether the entry is shown in mobile mode. Defaults to true; false keeps
  desktop-only controls, such as launchers of desktop side panels, off touch toolbars. */
    mobile?: boolean | undefined;
    /** Host-defined metadata, such as a command id; never interpreted by Toolbar. */
    meta?: unknown;
    /** Default command parameters; custom renderers may supply a different payload. */
    payload?: unknown;
    /** Registry key for an arbitrary custom control using public Toolbar primitives. */
    renderer?: string | undefined;
    /** Registry key for a selector, disclosure, or split button's Popover body. */
    contentRenderer?: string | undefined;
    /** Popup body inset; none lets a composed list or picker own its outer spacing. Defaults to default. */
    contentPadding?: "default" | "none" | undefined;
    /** Controlled popup state; omission gives each mounted entry local state. */
    expanded?: boolean | undefined;
    /** Optional accessible description element id. */
    describedBy?: string | undefined;
    /** Split primary action name; defaults to label. */
    actionLabel?: string | undefined;
    /** Split primary explanation; defaults to its action name. */
    actionTooltip?: string | false | undefined;
    /** Split disclosure name; defaults to label. */
    disclosureLabel?: string | undefined;
    /** Split disclosure explanation; defaults to its disclosure name. */
    disclosureTooltip?: string | false | undefined;
    /** Disable only the split primary action. */
    actionDisabled?: boolean | undefined;
    /** Disable only the split disclosure. */
    disclosureDisabled?: boolean | undefined;
    /** Host-owned toggle state, also supported by a split entry primary action. */
    pressed?: QuireKitToolbarToggleState | undefined;
    /** Ordered children of a semantic group. */
    children?: readonly QuireKitToolbarEntry[] | undefined;
    /** Declarative menu entries for a menu trigger or split disclosure; takes precedence over split contentRenderer. */
    items?: readonly QuireKitMenuEntry[] | undefined;
  };
  /** Stable ancestry within the configured toolbar. */
  path: readonly string[];
  /** Host-owned state snapshot or services; Toolbar never interprets it. */
  context: unknown;
  /** Effective availability, including enclosing groups. */
  disabled: boolean;
  /** Current popup state. */
  expanded: boolean;
  /** Request a popup transition. */
  setExpanded: { (expanded: boolean): void; };
  /** Request execution. */
  execute: { (payload?: unknown, nativeEvent?: Event | undefined): void; };
};
```

### QuireToolbarField

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Accessible field name and default Tooltip explanation. |
| tooltip | 否 | undefined | Override the explanation; false delegates it to another compound owner. |
| disabledReason | 否 | — | Explanation displayed while the field is unavailable. |
| disabled | 否 | — | Current field availability; also bind disabled to the slotted public field. |
| width | 否 | — | Optional intrinsic CSS width for the field, preserved during overflow. |
| expanded | 否 | — | Whether the field's interactive popup is open. |

**label**

```ts
string
```

**tooltip**

```ts
string | false | undefined
```

```ts
undefined | string | false
```

**disabledReason**

```ts
string | undefined
```

```ts
undefined | string
```

**disabled**

```ts
boolean | undefined
```

**width**

```ts
string | undefined
```

```ts
undefined | string
```

**expanded**

```ts
boolean | undefined
```

#### Events

无。

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | Existing Input, Select or Combobox; bind size to keep its public geometry aligned. |

**default**

```ts
{ readonly size: "sm"; }
```

```ts
{
  size: "sm";
}
```

#### 公开实例成员

无。

### QuireToolbarAction

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | 动作的可访问名称，图标不会替代此名称。 |
| tooltip | 否 | undefined | Tooltip explanation; defaults to the accessible label. |
| shortcut | 否 | — | Keys shown beside the tooltip text in reading order; display only. |
| disabledReason | 否 | — | Reason displayed while this control is unavailable. |
| text | 否 | — | Optional visible text beside the icon. |
| type | 否 | "button" | Native button submission behavior. |
| disabled | 否 | false | Whether activation and keyboard focus are unavailable. |
| describedBy | 否 | — | Optional description element for a disabled reason or tooltip detail. |

**label**

```ts
string
```

**tooltip**

```ts
string | false | undefined
```

```ts
undefined | string | false
```

**shortcut**

```ts
readonly string[] | undefined
```

```ts
undefined | readonly (string)[]
```

**disabledReason**

```ts
string | undefined
```

```ts
undefined | string
```

**text**

```ts
string | undefined
```

```ts
undefined | string
```

**type**

```ts
"submit" | "reset" | "button" | undefined
```

```ts
undefined | "submit" | "reset" | "button"
```

**disabled**

```ts
boolean | undefined
```

**describedBy**

```ts
string | undefined
```

```ts
undefined | string
```

#### Events

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

**activate**

```ts
[event: MouseEvent]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | 图标内容，通常使用 QuireIcon。 |

**default**

```ts
any
```

#### 公开实例成员

无。

### QuireToolbarToggle

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | 开关的可访问名称，图标不会替代此名称。 |
| tooltip | 否 | undefined | Tooltip explanation; defaults to the accessible label. |
| shortcut | 否 | — | Keys shown beside the tooltip text in reading order; display only. |
| disabledReason | 否 | — | Reason displayed while this control is unavailable. |
| text | 否 | — | Optional visible text beside the icon. |
| type | 否 | "button" | Native button submission behavior. |
| disabled | 否 | false | Whether activation and keyboard focus are unavailable. |
| describedBy | 否 | — | Optional description element for a disabled reason or tooltip detail. |
| modelValue | 否 | false |  |

**label**

```ts
string
```

**tooltip**

```ts
string | false | undefined
```

```ts
undefined | string | false
```

**shortcut**

```ts
readonly string[] | undefined
```

```ts
undefined | readonly (string)[]
```

**disabledReason**

```ts
string | undefined
```

```ts
undefined | string
```

**text**

```ts
string | undefined
```

```ts
undefined | string
```

**type**

```ts
"submit" | "reset" | "button" | undefined
```

```ts
undefined | "submit" | "reset" | "button"
```

**disabled**

```ts
boolean | undefined
```

**describedBy**

```ts
string | undefined
```

```ts
undefined | string
```

**modelValue**

```ts
QuireKitToolbarToggleState | undefined
```

```ts
undefined | false | true | "mixed"
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| update\:modelValue | 否 | — |  |
| activate | 否 | — |  |

**update:modelValue**

```ts
[value: QuireKitToolbarToggleState]
```

**activate**

```ts
[pressed: boolean, event: MouseEvent]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | 图标内容，通常使用 QuireIcon。 |

**default**

```ts
any
```

#### 公开实例成员

无。

### QuireToolbarColorPickerDisclosure

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Accessible action name for the color disclosure. |
| tooltip | 否 | undefined | Tooltip explanation; defaults to the accessible label. |
| disabledReason | 否 | — | Reason displayed while this control is unavailable. |
| disabled | 否 | false | 是否禁用执行与方向键聚焦；同时继承所在 Split Button 和 Color Picker 的禁用状态。 |
| describedBy | 否 | — | Optional description element for a disabled reason. |

**label**

```ts
string
```

**tooltip**

```ts
string | false | undefined
```

```ts
undefined | string | false
```

**disabledReason**

```ts
string | undefined
```

```ts
undefined | string
```

**disabled**

```ts
boolean | undefined
```

**describedBy**

```ts
string | undefined
```

```ts
undefined | string
```

#### Events

无。

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | Disclosure artwork, normally a directional QuireIcon. |

**default**

```ts
any
```

#### 公开实例成员

无。

### QuireToolbarDisclosure

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Accessible action name. |
| toggleOnClick | 否 | true | False delegates native click state to an enclosing Menu or Popover trigger. |
| tooltip | 否 | undefined | Tooltip explanation; defaults to the accessible label. |
| shortcut | 否 | — | Keys shown beside the tooltip text in reading order; display only. |
| disabledReason | 否 | — | Reason displayed while this control is unavailable. |
| indicator | 否 | false | Show a compact indicator beside the icon or visible label. |
| popup | 否 | "menu" | Popup type; false keeps persistent-panel semantics and its Tooltip while expanded. |
| controls | 否 | — | DOM id of the controlled popup when available. |
| text | 否 | — | Optional visible action label rendered beside the icon. |
| type | 否 | "button" | Native button submission behavior. |
| disabled | 否 | false | Whether activation and keyboard focus are unavailable. |
| describedBy | 否 | — | Optional description element for a disabled reason or tooltip detail. |
| expanded | 否 | false |  |

**label**

```ts
string
```

**toggleOnClick**

```ts
boolean | undefined
```

**tooltip**

```ts
string | false | undefined
```

```ts
undefined | string | false
```

**shortcut**

```ts
readonly string[] | undefined
```

```ts
undefined | readonly (string)[]
```

**disabledReason**

```ts
string | undefined
```

```ts
undefined | string
```

**indicator**

```ts
boolean | undefined
```

**popup**

```ts
false | QuireKitToolbarPopup | undefined
```

```ts
undefined | false | "dialog" | "grid" | "listbox" | "menu" | "tree"
```

**controls**

```ts
string | undefined
```

```ts
undefined | string
```

**text**

```ts
string | undefined
```

```ts
undefined | string
```

**type**

```ts
"submit" | "reset" | "button" | undefined
```

```ts
undefined | "submit" | "reset" | "button"
```

**disabled**

```ts
boolean | undefined
```

**describedBy**

```ts
string | undefined
```

```ts
undefined | string
```

**expanded**

```ts
boolean | undefined
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| activate | 否 | — |  |
| update\:expanded | 否 | — |  |

**activate**

```ts
[expanded: boolean, event: KeyboardEvent | MouseEvent]
```

**update:expanded**

```ts
[value: boolean]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | Leading icon component, normally QuireIcon. |
| indicator | 否 | — | Disclosure indicator component, normally a directional QuireIcon. |

**default**

```ts
any
```

**indicator**

```ts
any
```

#### 公开实例成员

无。

### QuireToolbarGroup

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 否 | — | Accessible group name when several actions share one task. |

**label**

```ts
string | undefined
```

```ts
undefined | string
```

#### Events

无。

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | Related Toolbar actions rendered in DOM order. |

**default**

```ts
any
```

#### 公开实例成员

无。

### QuireToolbarSeparator

#### Props

无。

#### Events

无。

#### Slots

无。

#### 公开实例成员

无。

### QuireToolbarSelector

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Accessible action name. |
| text | 是 | — | Current visible value. |
| toggleOnClick | 否 | true | False delegates native click state to an enclosing Menu or Popover trigger. |
| tooltip | 否 | undefined | Tooltip explanation; defaults to the accessible label. |
| shortcut | 否 | — | Keys shown beside the tooltip text in reading order; display only. |
| disabledReason | 否 | — | Reason displayed while this control is unavailable. |
| popup | 否 | "menu" | 展开的浮层类型。 |
| controls | 否 | — | DOM id of the controlled popup when available. |
| type | 否 | "button" | Native button submission behavior. |
| disabled | 否 | false | Whether activation and keyboard focus are unavailable. |
| describedBy | 否 | — | Optional description element for a disabled reason or tooltip detail. |
| expanded | 否 | false |  |

**label**

```ts
string
```

**text**

```ts
string
```

**toggleOnClick**

```ts
boolean | undefined
```

**tooltip**

```ts
string | false | undefined
```

```ts
undefined | string | false
```

**shortcut**

```ts
readonly string[] | undefined
```

```ts
undefined | readonly (string)[]
```

**disabledReason**

```ts
string | undefined
```

```ts
undefined | string
```

**popup**

```ts
QuireKitToolbarPopup | undefined
```

```ts
undefined | "dialog" | "grid" | "listbox" | "menu" | "tree"
```

**controls**

```ts
string | undefined
```

```ts
undefined | string
```

**type**

```ts
"submit" | "reset" | "button" | undefined
```

```ts
undefined | "submit" | "reset" | "button"
```

**disabled**

```ts
boolean | undefined
```

**describedBy**

```ts
string | undefined
```

```ts
undefined | string
```

**expanded**

```ts
boolean | undefined
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| activate | 否 | — |  |
| update\:expanded | 否 | — |  |

**activate**

```ts
[expanded: boolean, event: KeyboardEvent | MouseEvent]
```

**update:expanded**

```ts
[value: boolean]
```

#### Slots

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| default | 否 | — | Optional leading icon component, normally QuireIcon. |
| indicator | 否 | — | 自定义展开图标。 |

**default**

```ts
any
```

**indicator**

```ts
any
```

#### 公开实例成员

无。
