---
title: "卡片"
subtitle: "<Card> 与 <CardGroup> 用于导航和概览，可带图标、图片与链接。"
---

卡片用于导航和概览。设置 `href` 后整张卡片可点击；`<CardGroup>`（别名 `<Cards>`）把卡片排成 1–4 列的网格，窄屏时自动折叠为单列。

```mdx
<CardGroup cols={3}>
  <Card title="快速开始" icon="lucide:rocket" href="/guides/get-started/quickstart">
    五分钟发布第一个站点。
  </Card>
  <Card title="组件" icon="lucide:blocks" iconPosition="left">
    图标在左侧。
  </Card>
  <Card title="品牌色" icon="lucide:palette" color="#7C5CFF">
    自定义图标颜色。
  </Card>
</CardGroup>
```

<CardGroup cols={3}>
  <Card title="快速开始" icon="lucide:rocket" href="../get-started/quickstart.mdx">
    五分钟发布第一个站点。
  </Card>
  <Card title="组件" icon="lucide:blocks" iconPosition="left">
    图标在左侧。
  </Card>
  <Card title="品牌色" icon="lucide:palette" color="#7C5CFF">
    自定义图标颜色。
  </Card>
</CardGroup>

## 带图片与横向卡片

```mdx
<CardGroup cols={2}>
  <Card title="构建管线" src="/assets/pipeline.svg" href="/guides/get-started/concepts">
    从源文件到静态产物。
  </Card>
  <Card title="横向卡片" icon="lucide:terminal" horizontal arrow href="/guides/reference/cli" cta="查看 CLI">
    horizontal、arrow 与 cta。
  </Card>
</CardGroup>
```

<CardGroup cols={2}>
  <Card title="构建管线" src="/assets/pipeline.svg" href="../get-started/concepts.mdx">
    从源文件到静态产物。
  </Card>
  <Card title="横向卡片" icon="lucide:terminal" horizontal arrow href="../reference/cli.mdx" cta="查看 CLI">
    horizontal、arrow 与 cta。
  </Card>
</CardGroup>

## Card 属性

<ParamField path="title" type="string">卡片标题。</ParamField>
<ParamField path="icon" type="icon">图标，也可以是 JSX（如 `<img>`）。</ParamField>
<ParamField path="href" type="url">让整张卡片成为链接。推荐写源文件路径（`./quickstart.mdx`）。</ParamField>
<ParamField path="target" type="string">链接目标，外部链接默认 `_blank`。</ParamField>
<ParamField path="iconPosition" type="top | left" default="top">图标位置。</ParamField>
<ParamField path="iconSize" type="number" default="8">图标大小，以 4px 为单位（默认 8 = 32px）。</ParamField>
<ParamField path="color" type="color">图标颜色（深浅模式通用）。</ParamField>
<ParamField path="lightModeColor / darkModeColor" type="color">分别指定浅色 / 深色模式下的图标颜色。</ParamField>
<ParamField path="src" type="url">卡片图片（也接受 `img`、`image`）。</ParamField>
<ParamField path="imagePosition" type="top | left | right | bottom" default="top">图片位置。</ParamField>
<ParamField path="imageWidth / imageHeight" type="string">图片尺寸，例如 `200px`、`50%`。</ParamField>
<ParamField path="horizontal" type="boolean" default="false">紧凑的横向布局：图标与标题排在一行。</ParamField>
<ParamField path="cta" type="string">卡片底部的行动文字，例如「查看文档」。</ParamField>
<ParamField path="arrow" type="boolean">右上角显示箭头。</ParamField>
<ParamField path="iconType" type="solid | regular | brands" default="solid">`icon` 只写图标名称时使用的 Font Awesome 样式：`solid` 实心、`regular` 线框、`brands` 品牌；`light`、`thin`、`duotone` 按线框显示。`icon` 写了完整类名（如 `fa-regular fa-bell`）或 `lucide:` 图标时不起作用。</ParamField>

## CardGroup 属性

<ParamField path="cols" type="number" default="2">列数，1–4（也接受 `columns`）。</ParamField>
