> For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt.

# 问询卡

`AskHumanCard` 是展示在回答气泡内的一组选项按钮，适合流程需要用户主动确认选择或执行固定跳转的场景。


![AskHumanCard 问询卡效果](//lf-flow-web-cdn.doubao.com/obj/flow-doubao/goofy_deploy_edenx/flow/doubao-apps--plugin-doc/static/image/ask-human-card.c8a19ffb6c.png)

## 示例

```tsx
import { AskHumanCard, type AskHumanCardItem } from '@doubao-dev/template';

const items: AskHumanCardItem[] = [
  {
    key: 'latte',
    text: '轻芝士拿铁',
    onClick: () => console.log('select latte')
  },
  {
    key: 'grape',
    text: '冰葡萄特饮',
    onClick: () => console.log('select grape')
  },
  {
    key: 'skip',
    text: '跳过',
    showArrow: 'right',
    onClick: () => console.log('skip')
  }
];

export default function CoffeeQuestionCard() {
  return <AskHumanCard items={items} />;
}
```

固定跳转场景使用 `jump` 变体。1 个选项占满一行，2 个选项平分一行；3 个及以上选项会回退为纵向排列：

```tsx
<AskHumanCard
  variant="jump"
  items={[
    {
      key: 'recharge',
      text: '去充值',
      showArrow: 'right',
      onClick: () => console.log('open recharge')
    }
  ]}
/>
```

跳转外部应用时，将选项的 `openType` 设置为 `'launchApp'`，并通过 `launchAppUrl` 传入 deeplink：

```tsx
<AskHumanCard
  variant="jump"
  items={[
    {
      key: 'open-app',
      text: '打开外部应用',
      showArrow: 'right',
      openType: 'launchApp',
      launchAppUrl: 'your-app://path',
      onLaunchApp: (result) => console.log('launch app success', result),
      onLaunchAppError: (error) => console.error('launch app failed', error)
    }
  ]}
/>
```

## 主要 Props

| Prop      | 类型                       | 说明                        |
| --------- | ------------------------ | ------------------------- |
| `items`   | `AskHumanCardItem[]`     | 选项列表                      |
| `variant` | `'suggestion' \| 'jump'` | 选项行为和排列语义，默认 `suggestion` |
| `onClick` | `(event) => void`        | 卡片根节点点击事件                 |

### AskHumanCardItem

| Prop               | 类型                                  | 必填 | 说明                                        |
| ------------------ | ----------------------------------- | -- | ----------------------------------------- |
| `key`              | `TemplateKey`                       | 否  | 选项唯一标识                                    |
| `text`             | `TemplateText`                      | 否  | 选项文案                                      |
| `loading`          | `boolean`                           | 否  | 是否展示加载状态；加载时禁用点击                          |
| `openType`         | `'launchApp'`                       | 否  | 设置为 `'launchApp'` 时，点击选项跳转外部应用            |
| `launchAppUrl`     | `string`                            | 否  | 外部应用的 deeplink；`openType="launchApp"` 时必填 |
| `onLaunchApp`      | `(result: LaunchAppResult) => void` | 否  | 成功跳转外部应用时触发                               |
| `onLaunchAppError` | `(error: unknown) => void`          | 否  | 跳转外部应用失败时触发                               |
| `showArrow`        | `'left' \| 'right' \| 'none'`       | 否  | 箭头位置，默认不展示                                |
| `onClick`          | `(event?) => void`                  | 否  | 点击选项时触发                                   |

## 使用说明

- 选项文案通过 `text` 配置。
- `showArrow` 支持 `'left'`、`'right'` 和 `'none'`，默认不展示箭头。
- `loading: true` 时展示加载状态并禁用该选项的点击。
- 跳转外部应用时，必须同时配置 `openType: 'launchApp'` 和 `launchAppUrl`。
- 外部应用跳转结果分别通过 `onLaunchApp` 和 `onLaunchAppError` 回调。
- 普通候选项使用默认的 `suggestion`；单个或两个固定跳转入口使用 `variant="jump"`。
