Card 和 CardGroup
卡片将一段文本变成一个目的地:包含图标、标题、一句话,以及(如果有 href)一个应用于整张卡片的链接。将卡片放入 CardGroup,即可按网格排列。
示例
mdx
<CardGroup cols={2}>
<Card title="Quickstart" icon="rocket" href="/guides/quickstart">
Make your first request in five minutes.
</Card>
<Card title="Authentication" icon="key" href="/guides/authentication">
Create a key and send it.
</Card>
</CardGroup>Card 属性
titlestring标题。
iconstring显示在标题上方的字形,使用图标名称。
hrefstring使整张卡片都成为链接,指向你网站上的页面或任意 URL。角标会指示链接的去向:指向你网站页面时显示链接标记,其他情况则显示外部链接标记。外部链接会在新标签页中打开。如果没有 href,卡片就是静态内容块。
childrenMarkdown标题下方的文本,写在标签之间。开始标签后和结束标签前都要留一个空行。
CardGroup 属性
colsnumber列数,范围为 1 到 6。其他值都会回退为 2。在手机上,无论设置为何值,卡片都会重新排列为单列。
childrenCard卡片。
有链接和无链接
mdx
<CardGroup cols={3}>
<Card title="With a link" icon="link" href="/guides/quickstart">
The whole card is clickable.
</Card>
<Card title="Without a link" icon="book">
A static block, for a list of facts.
</Card>
<Card title="External" icon="globe" href="https://www.openapis.org">
Opens in a new tab, with its own mark.
</Card>
</CardGroup>