Skip to content

CardGrid 卡片网格

基本用法

卡片网格 可以实现卡片组合响应式的布局,可以根据需要调整列数。


Headers

Ever tried driving without GPS? Boom! That's why websites need headers for direction.

Content

Dive into the meat and potatoes of a site; without it, you'd just be window shopping. Content is king.

Call-to-Action

That enthusiastic friend who's always urging, "Do it! Do it!"? Yeah, that's this button nudging you towards adventure.

Pricing

Behold the dessert menu of the website world. Tempting choices await, can you resist?


<CardGrid
columns={2}
items={[
{
title: 'Headers',
description: "Ever tried driving without GPS? Boom! That's why websites need headers for direction.",
icon: 'flat-color-icons:template',
},
{
title: 'Content',
description:
"Dive into the meat and potatoes of a site; without it, you'd just be window shopping. Content is king.",
icon: 'flat-color-icons:document',
},
{
title: 'Call-to-Action',
description:
'That enthusiastic friend who\'s always urging, "Do it! Do it!"? Yeah, that\'s this button nudging you towards adventure.',
icon: 'flat-color-icons:advertising',
},
{
title: 'Pricing',
description: 'Behold the dessert menu of the website world. Tempting choices await, can you resist?',
icon: 'flat-color-icons:currency-exchange',
},
]}
classes={{
container: "gap-4 md:gap-6",
panel:
"shadow-[0_4px_30px_rgba(0,0,0,0.1)] dark:shadow-[0_4px_30px_rgba(0,0,0,0.1)] dark:bg-slate-900",
icon: "w-12 h-12 mb-6 text-primary",
}}
/>

API

属性说明类型默认值
items配置项Array[]
columns默认显示的卡片列数number-
defaultIcon默认icon,当每项 item 没有设置icon时, defaultIcon生效string-
classes组件样式object

CardGrid.items

属性说明类型默认值
title标题string-
description描述信息string-
icon该项对应的icon图标,如果不设置 icon,则使用 defaultIconstring-
classes同组件classes属性,推荐使用组件属性设置样式object-
callToAction该项中<Button>组件的配置,继承自 Button 组件object

CardGrid.classes

属性说明类型默认值
containerCardGrid 组件容器的样式,即响应式容器的样式string-
panel卡片面板的样式string-
title作用于 CardGrid 组件 每一项的 title 的样式string-
description作用于 CardGrid 组件 每一项的 description 的样式string-
icon作用于 CardGrid 组件 每一项的 icon 的样式string-