AI卡片生成器。

描述卡片承载的内容,MeDo即可生成完整容器 — 媒体、标题、正文与底部插槽,悬停浮起效果,用aspect-ratio锁定的图片,网格中的等高布局,以及配套的骨架屏状态。

卡片
卡片

卡片是一份布局契约,而不是带边框的盒子

圆角和阴影一分钟就能写完,所以卡片常被当作微不足道的小东西。真正出问题的是它周围的一切。一张卡片标题两行,旁边那张四行,底部就再也对不齐了。图片以意外的比例返回,网格在绘制之后重新回流。有人把整张卡片做成可点击,却把"保存"按钮困在 anchor 内部,产生无效的HTML和无法触达的控件。这些是卡片处于集合中时的属性,而非单张卡片的属性。正因如此,把容器、媒体约束、底部对齐和加载状态作为一个整体生成,比把一个 div 样式写得漂亮更有价值。

6 个模板

可以生成的 卡片 模板

每个模板都是真实的提示词,而不是截图。复制到任意 AI 编辑器,或在 MeDo 中运行,直接拿到 React + Tailwind 代码。

BasicSlots + Skeleton

Four-Slot Card With a Matching Skeleton

The container everything else extends. Generating the skeleton in the same pass is what keeps the two the same size six months later.

Create a card component with four optional slots: media at the top, a header with title and subtitle, a body for description text, and a footer for actions or metadata. White surface, 12px radius, 1px light grey border, 20px internal padding. Make the card a flex column with the body allowed to grow so the footer sits at the bottom and cards in a row stay equal height regardless of title wrapping. Lock the media to a 16:9 ratio with object-fit cover and explicit dimensions. Include a skeleton variant whose grey blocks match the real layout exactly — same media ratio, same line count, same footer height — so nothing shifts when data arrives.

在 MeDo 中尝试
CommerceProduct Card

Image, Price and Add to Cart

The hardest card to get right because it needs a whole-card link and a nested button. Wrap the card in an anchor and the button becomes invalid markup and unreachable.

Create a product card: a 1:1 image with object-fit cover and a reserved box, an optional discount badge in the top-left, the product name over two lines with a line clamp, a price row with the current price and a struck-through original, a star rating with a review count, and an Add to cart button in the footer. Make the whole card navigate to the product page by putting the anchor on the product name and stretching it over the card with an absolutely positioned pseudo-element, then raise the cart button above it with a higher z-index so both targets work. Add an out-of-stock state that dims the image and swaps the button for a Notify me control.

在 MeDo 中尝试
EditorialArticle Card

Cover Image, Headline and Byline

One headline wraps to two lines and its neighbor to four. Without a growing body the bylines end up on different baselines and the whole index looks unfinished.

Create an article card: a 16:9 cover image with a reserved aspect box, a category badge, a headline clamped to two lines, an excerpt clamped to three, and a footer row with an author avatar, author name, publish date and read time. Make it a flex column with the excerpt allowed to grow so bylines align across a row of cards with different headline lengths. Put the anchor on the headline and stretch it across the card so the accessible name is the headline rather than "read more". Add a featured variant that spans two grid columns with the media on the left and the text on the right.

在 MeDo 中尝试
DashboardMetric Card

Stat Card With Delta and Sparkline

No media, all typography. The number is the component, so lock its width with tabular figures or the whole row twitches on every poll.

Create a metric card for a dashboard: a small uppercase label, a large numeric value using tabular figures so the width does not jitter as the number updates, a change indicator showing the delta with an arrow and a green or red tint, and an optional sparkline across the bottom. Never rely on color alone for direction — pair the tint with an arrow glyph and a visually hidden "up" or "down". Reserve the sparkline height even before data arrives. Include a loading variant that shows a shimmering block at the exact value height, and an empty state reading "No data yet" rather than a zero that looks like a real measurement.

在 MeDo 中尝试
ConversionPricing Card

Plan Card With a Highlighted Tier

Three cards that must end on one line. If the highlighted tier gets a thicker border, compensate with padding or it will sit one pixel taller than its neighbors.

Create a pricing card: plan name, price with a billing period suffix, a one-line positioning sentence, a feature list with check icons, and a call-to-action button pinned to the bottom. Add a highlighted variant with a thicker border, a "Most popular" badge overlapping the top edge, and reduced internal padding so the extra border width does not make it taller than the adjacent cards. Make the card a flex column with the feature list growing, so buttons across three plans of different feature counts land on the same line. Keep the price in tabular figures and mark the currency and period as separate spans for annual and monthly toggling.

在 MeDo 中尝试
InteractiveClickable Card

Whole-Card Link With Nested Controls

The pattern that fixes the most common card bug. One stretched anchor, real controls layered above it, no interactive element nested inside another.

Create a fully clickable card that stays valid HTML: put a single anchor on the card title and expand it over the whole card with an absolutely positioned ::after pseudo-element covering the container, rather than wrapping the card in an anchor. Give the container position relative and any nested control — a bookmark toggle, an overflow menu, a secondary link — a higher z-index plus position relative so it remains clickable. Drive the hover elevation from the container so hovering anywhere raises the card, and mirror it on focus-within so keyboard users see the same state. Skip the translate transform when prefers-reduced-motion is set and keep the shadow change.

在 MeDo 中尝试

如何自定义你的 卡片

锁定媒体的aspect-ratio

为图片区域明确指定 aspect-ratio 并配合 object-fit cover。若没有预留盒子,尺寸各异的图片会在加载后重新调整卡片大小,这会直接损害 Cumulative Layout Shift,也是卡片网格中最显眼的缺陷。

把底部固定在最下方

声明卡片为纵向 flex 布局且正文可以伸展,这样即使标题折行数不同,同一行的底部也能对齐。参差不齐的操作行是让原本整洁的网格显得半成品的最快方式。

只选择一种点击策略

要么整张卡片是链接,要么内部元素是链接,绝不能同时存在。若要整卡可点击,请在标题上使用单个 anchor,并用绝对定位的伪元素铺满卡片,这样无障碍名称仍有意义,也为上层的嵌套控件留出了空间。

让骨架屏与卡片一起生成

要求加载变体的灰色区块与真实尺寸一致,包括媒体比例和文本行数。尺寸不同的骨架屏毫无意义,因为数据到达的那一刻布局照样会跳动。

谁在使用 卡片 组件

电商商品网格

正方形商品图、名称、价格和评分行,底部的"加入购物车"按钮位于通向商品页的整卡链接之上,两个点击目标都能正常工作且无需嵌套。

博客或资源列表

16:9封面图、分类标签、折成两行的标题、摘要,以及无论标题多长都能在整行对齐的作者与阅读时长底部。

SaaS仪表盘

完全没有媒体区的指标卡片:标签、大号数值、变化指示器和迷你折线图,在查询完成前的首次绘制中以骨架屏呈现。

价格或方案对比

三张等高卡片,其中一张用更粗的边框和标签突出显示,每张都以固定在底部的行动号召按钮结尾,使按钮排在同一条线上。

不同网站的 卡片 方案

同一个 卡片 组件,针对它所在网站的类型做调整。

01 / 06

SaaS Dashboard Cards

Metric cards with no media at all, so the number carries the whole layout. Use tabular figures and reserve the value height, because a card grid fed by a polling query will otherwise reflow every few seconds. Borders beat shadows here — twelve elevated cards on one screen read as noise rather than hierarchy.

卡片 的风格与变体

挑选与页面其余部分匹配的变体,然后生成它。

01 / 06

Bordered Card

A 1px border, no shadow. The right default for dense interfaces — tables, dashboards, settings panels — where every card needs an edge but none of them should appear to float. Keep the border one step darker than the divider color or the card dissolves into the page.

在 React、Next.js、Vue 与 Svelte 中使用 卡片

React、Next.js、Vue 3、SvelteKit、Astro 或纯 HTML —— 同一个 卡片,六种接入方式。

01 / 06

React Card

Expose the slots as subcomponents — Card.Header, Card.Body, Card.Footer — rather than as props, so a metric card can omit the media without passing null. No state means no hooks, which is what lets you render sixty of them in a grid.

src/components/Card.tsx

export function Card({ className, ...props }) {
  return (
    <div
      className={cn(
        'flex flex-col rounded-xl border bg-white p-5',
        'transition-shadow hover:shadow-lg',
        className
      )}
      {...props}
    />
  )
}
Card.Footer = ({ children }) => <div className="mt-auto pt-4">{children}</div>

如何把 卡片 加入项目

四个步骤,从挑选 卡片 模板到上线生产环境。

01~30s

Pick a Card Template

Scan the six templates and start from the content you are displaying — product with a cart button, article with a byline, metric with a delta, or pricing tier.

02~10s

Copy the Prompt

Take the prompt into MeDo, Lovable, Bolt, v0 or Cursor. Say what grid the card lives in before you run it, because the column count is what determines the media ratio and the equal-height rules.

03~1min

Generate and Refine

You get React + Tailwind back with a live preview. Follow up in plain English — "clamp the title to two lines", "swap the shadow for a border", "add the skeleton" — instead of editing the flex utilities by hand.

04~2min

Drop It Into the Grid

Render it inside a CSS grid so rows stretch to match, then check a row where one title wraps and another does not. That is the case that reveals whether the footer is actually pinned.

关于 卡片 的常见问题

如何用AI生成卡片组件?

描述卡片包含什么以及将如何使用,例如"商品卡片,含方形图片、标题、价格和加入购物车底部,用于三列网格"。MeDo会一并生成插槽结构、媒体约束和悬停状态。提到网格很重要,因为它决定了等高规则和 aspect-ratio 规则。

卡片组件由哪些部分组成?

四个区域几乎覆盖所有场景:可选的媒体区、包含标题及辅助文字的头部、承载描述内容的正文区,以及放置操作或元数据的底部。把它们当作可选插槽而非必需标记,一个组件就能同时充当商品卡片、文章卡片和指标卡片,无需为每种情况单独做变体。

整张卡片可以点击吗?

可以,但如果卡片内含按钮或其他链接,就不要用 anchor 包裹整张卡片,因为嵌套交互元素属于无效HTML,浏览器的处理方式也难以预测。把 anchor 放在标题上,用绝对定位的伪元素铺满卡片,再用更高的 z-index 把嵌套控件抬到它上面。

如何让网格中的卡片等高?

使用 CSS grid,它本身就会把同一行的项目拉伸到一致高度;同时把卡片自身设为纵向 flex 布局,让可伸展的正文把底部推下去。固定高度是错误的做法,因为只要有一个标题多折一行,内容就会被裁切。

卡片应该用阴影还是边框?

在仪表盘、表格这类信息密集的界面中,边框更易读,过多阴影会造成视觉噪声。阴影适合留白充裕的营销页面,让卡片从背景中浮起。选定其中一种作为默认,把另一种留给强调或抬升的变体,而不是在同一层级混用。

卡片需要加载骨架屏吗?

任何由网络请求驱动的卡片都会受益,因为按真实内容尺寸设计的骨架屏能避免数据到达时页面回流。在生成卡片的同一个提示词里要求骨架屏,两者会在构造上共享尺寸;分开编写时这一点很难长期维持。