# Chat Message Action

> 带提示和状态反馈的低强调消息操作。

网页来源：/components/chat-message-action

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

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

`action` 提供名称、图标与 `busy`、`disabled`、`pressed`。图标操作默认包含 Tooltip；激活时发出操作 ID，不执行业务。选中和聚焦会增强对比，普通态保持低强调。作为已有菜单触发器时可关闭 `tooltip`。

默认复用公共 Button 的 `xs` 紧凑尺寸与圆角，图标进一步收小，普通态使用 muted 颜色；悬停、键盘聚焦与选中时增强对比。触控环境仍保留至少 44px 的点击区域，不随桌面图标一起缩小。

### 示例：chat-message-action/basic

文件：`basic.vue`

```vue
<script setup lang="ts">
import { ref } from 'vue';
import { QuireChatMessageAction } from '@quirekit/ui/vue';
const useful = ref(false);
</script>
<template>
  <div class="flex items-center gap-qk-inline p-qk-surface">
    <QuireChatMessageAction :action="{ id: 'help', label: '有帮助', icon: 'thumbsUp', pressed: useful }" @action="useful = !useful" />
    <QuireChatMessageAction :action="{ id: 'save', label: '正在保存', icon: 'bookmark', busy: true }" />
    <QuireChatMessageAction :action="{ id: 'share', label: '暂不可分享', icon: 'share', disabled: true }" />
    <span class="text-qk-helper text-qk-text-tertiary">{{ useful ? '已标记为有帮助' : '选择一项反馈' }}</span>
  </div>
</template>
```

## API

### QuireChatMessageAction

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| action | 是 | — | 命令描述；业务执行由 action 事件接收者负责。 |
| tooltip | 否 | true | 图标操作默认提供 Tooltip；作为已有菜单 trigger 时可关闭。 |

**action**

```ts
QuireKitChatAction
```

```ts
{
  /** 在所属操作组内稳定且唯一的标识。 */
  id: string;
  /** 可见名称或图标操作的辅助名称。 */
  label: string;
  /** IconProvider 中的图标名；省略时显示文字按钮。 */
  icon?: undefined | string;
  /** 明确不可执行时禁用。 */
  disabled?: boolean | undefined;
  /** 宿主正在处理此操作；阻止重复触发。 */
  busy?: boolean | undefined;
  /** 内联反馈/开关类操作的受控按下状态；有此状态的操作保持内联。 */
  pressed?: boolean | undefined;
  /** 需要危险语义的操作。 */
  danger?: boolean | undefined;
  /** inline 留在操作栏，more 放进紧凑的公共 Menu。 */
  placement?: undefined | "inline" | "more";
  /** 消息级默认 settled，Part 级默认 always；active 用于停止，always 用于必要恢复/确认。 */
  when?: undefined | "settled" | "active" | "always";
}
```

**tooltip**

```ts
boolean | undefined
```

#### Events

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

**action**

```ts
[id: string]
```

#### Slots

无。

#### 公开实例成员

无。

#### 相关类型

```ts
type QuireKitChatAction = {
  /** 在所属操作组内稳定且唯一的标识。 */
  id: string;
  /** 可见名称或图标操作的辅助名称。 */
  label: string;
  /** IconProvider 中的图标名；省略时显示文字按钮。 */
  icon?: undefined | string;
  /** 明确不可执行时禁用。 */
  disabled?: boolean | undefined;
  /** 宿主正在处理此操作；阻止重复触发。 */
  busy?: boolean | undefined;
  /** 内联反馈/开关类操作的受控按下状态；有此状态的操作保持内联。 */
  pressed?: boolean | undefined;
  /** 需要危险语义的操作。 */
  danger?: boolean | undefined;
  /** inline 留在操作栏，more 放进紧凑的公共 Menu。 */
  placement?: undefined | "inline" | "more";
  /** 消息级默认 settled，Part 级默认 always；active 用于停止，always 用于必要恢复/确认。 */
  when?: undefined | "settled" | "active" | "always";
};
```
