> 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.

# 信息卡

`ContentCard` 用于承载单项或多项通用信息，由标题栏、列表内容和底部操作区组成。每个列表项可以包含图片、标题、描述和操作控件，适合展示商品、服务或内容入口。


![ContentCard 信息卡效果](//lf-flow-web-cdn.doubao.com/obj/flow-doubao/goofy_deploy_edenx/flow/doubao-apps--plugin-doc/static/image/content-card.c221a1d55b.png)

## 示例

```tsx
import { ContentCard, type ContentCardItem } from '@doubao-dev/template';
import coffeeImage from '../../assets/coffee.png';

const items: ContentCardItem[] = [
  {
    key: 'coffee-001',
    title: '榛果拿铁',
    subtitle: '中杯 · 热饮 · 少糖',
    thumbnailSrc: coffeeImage,
    action: { type: 'add', onClick: () => console.log('select coffee-001') }
  },
  {
    key: 'coffee-002',
    title: '冰葡萄特饮',
    subtitle: '大杯 · 冰饮'
  }
];

export default function CoffeeCard() {
  return (
    <ContentCard
      header={{
        actionText: '更多',
        onActionClick: () => console.log('view more')
      }}
      items={items}
      footer={{
        primaryActionButton: {
          text: '确认选择',
          onClick: () => console.log('confirm')
        }
      }}
    />
  );
}
```

## 主要 Props

| Prop     | 类型                        | 说明         |
| -------- | ------------------------- | ---------- |
| `header` | `TemplateCardHeaderProps` | 标题栏及右侧操作入口 |
| `items`  | `ContentCardItem[]`       | 列表数据，全量展示  |
| `footer` | `TemplateCardFooterProps` | 底部主、次操作按钮  |

`ContentCardItem` 的常用字段包括 `key`、`title`、`subtitle`、`description`、`thumbnailSrc`、`thumbnail`、`action` 和 `onClick`。

## 使用说明

- `title`、`subtitle` 和 `description` 支持字符串、数字或直接传入的 `Tag` / `Title`；字符串和数字使用模板默认的单行样式。需要两行标题时，传入 [Title](/apps-plugin/docs/templates/shared-components.md#title) 并设置 `maxLines={2}`。各行高度由内容决定，行间距为 2px。
- `thumbnailSrc` 是列表项左侧缩略图地址；`thumbnail` 只支持直接传入的 `<image />` 或 `<svg />`，同时传入时 `thumbnail` 优先。
- 带缩略图时，文字高度不超过 80px 图片则垂直居中，超过图片则与图片顶对齐；右侧操作控件始终与图片垂直居中。
- `action` 可以传按钮、添加控件、数量调节器、开关或播放控件配置。添加控件使用 `{ type: 'add', onClick }`；`Icon` Primitive 仅用于展示。数量调节器使用 `{ type: 'stepper', value, min?, max?, onChange }`，业务需在回调中更新 `value`。开关和播放控件也是受控组件，业务需要同步更新 `checked` 或 `playing`。
- 标题、描述、缩略内容和操作区分别使用对应的明确字段配置。
- 将同一项的 `action.type` 从 `add` 切换为 `stepper` 时会向左展开；切换由业务控制，不依赖数量值。
