Skip to content

Now in the official shadcn registry directory.

Start free

Card

A content container with 4 surface variants and 3 inset sizes, composed from header, title, description, content and footer parts.

displaylayout
A free styled version is available
Production
Deployed 12 minutes ago

4.2M requests this month across 3 regions.

Installation

Run the following command

npx shadcn@latest add @ai2/card

Dependencies, the @ai2/tokens theme and the component file are installed together. @ai2/glass installs alongside, since the glass variant reuses its overlay treatment.

Usage

TS
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"

<Card variant="elevated">
  <CardHeader>
    <CardTitle>Production</CardTitle>
    <CardDescription>Deployed 12 minutes ago</CardDescription>
  </CardHeader>
  <CardContent>4.2M requests this month.</CardContent>
  <CardFooter>…</CardFooter>
</Card>

Every part is optional. Compose only what you need. Header, content and footer pick up the card's inset padding automatically.

Examples

Variants

Outline
Border on the card surface.
Elevated
Soft shadow, no visible border.
Soft
Filled surface, borderless.
Glass
Translucent with backdrop blur.

glass is designed to sit over imagery or gradients. On a plain background it reads close to outline.

Inset

Small inset
Dense dashboards and sidebars.
Medium inset
The default density.
Large inset
Marketing and empty states.

Full anatomy

Invite your team
Collaborators get read access.

3 of 5 seats used on the current plan.

Props

The axes live on the root Card. CardHeader, CardTitle, CardDescription, CardContent and CardFooter are plain <div> wrappers and accept every native div prop.

PropTypeDefaultDescription
variant"outline" | "elevated" | "soft" | "glass""outline"Surface treatment: border, shadow, filled or translucent.
inset"sm" | "md" | "lg""md"Padding density, applied to the card and inherited by header, content and footer.

ai2 Card: a composable content container for React

The ai2 Card is a shadcn-compatible card component for React, styled with Tailwind CSS v4 on top of the shared ai2 token file. It is the workhorse surface of the system: dashboards, settings panels, pricing grids and empty states all start from the same six-part anatomy, with 4 surface variants and 3 inset densities controlled from the root.

Because it ships through the shadcn registry format, you install it with one CLI command, an MCP agent, or a copy-paste, and the source lands in your own project. You own the file; there is no runtime dependency on ai2 itself. The live example above is the exact component you get.

What is the ai2 Card?

It is a six-part composition: Card, CardHeader, CardTitle, CardDescription, CardContent and CardFooter. The anatomy matches shadcn/ui, so existing snippets, muscle memory and AI agents keep working, while the root adds two cva axes on top.

The root exposes variant (outline, elevated, soft, glass) and inset (sm, md, lg). The inset value cascades: header, content and footer read the card's padding through data-slot selectors, so density changes in one place. Every part is a plain div, which keeps the card server-safe and free of client-side JavaScript.

Why use it

  • Four surface variants: outline for the classic bordered card, elevated for a soft shadow, soft for a filled borderless surface, and glass for a translucent backdrop-blur panel over imagery.
  • Density as a prop: inset="sm", "md" or "lg" sets padding and gap for the whole card at once; header, content and footer inherit it automatically.
  • Compose only what you need: Every part is optional. A stat tile can be Card plus CardContent; a settings block can use the full header, content and footer stack.
  • Server component friendly: The card is plain divs with no "use client" directive and no state, so it renders in React Server Components without shipping JavaScript.
  • Agent-readable metadata: The registry item describes the variant matrix and intended use in plain words, so an MCP agent can find, inspect and install it without guessing.

Features

  • shadcn registry install: One command adds the component and the @ai2/tokens theme to your project.
  • Glass variant: Derived from the shared @ai2/glass overlay treatment: a token-driven translucent background with backdrop blur and inset highlights, tuned for both light and dark mode and designed to sit over gradients and imagery.
  • Theme-aware shadows: The elevated variant uses a subtle shadow in light mode and restores a visible border in dark mode, where shadows read poorly.
  • Data attributes for styling: The root exposes data-slot="card" and data-variant; every part has its own data-slot, so CSS overrides can target exact regions.
  • Exported cardVariants: The cva function is exported, so you can apply the same surface treatment to other elements, for example a link styled as a card.
  • TypeScript source: CardProps extends the native div props plus the cva axes, so autocomplete covers the full API in your editor.

Production tips

  • Match inset to context: Dense dashboards and sidebars read best with inset="sm"; the md default fits most product UI; reserve lg for marketing panels and empty states.
  • Use glass over imagery: The glass variant depends on what is behind it. On a plain background it reads close to outline, so pair it with a gradient, photo or chart.
  • Keep heading semantics yourself: CardTitle is a styled div, not an h-tag. If the card title matters for the document outline, render an h2 or h3 inside it.
  • Put actions in the footer: CardFooter is a flex row with a small gap, made for buttons. Keeping actions there gives every card in a grid the same visual rhythm.
  • Watch nested surfaces: A soft card inside another soft card can lose contrast. Alternate variants, for example outline inside soft, when you nest surfaces.

Works with the rest of ai2

The card is a natural host for the rest of the registry. Put an ai2 Avatar and an ai2 Badge in the header for user or status cards, fill the content with an ai2 Table for compact data views, and finish the footer with ai2 Button actions.

For loading states, mirror the card's layout with ai2 Skeleton blocks so content swaps in without shift. Everything shares one token source, so any combination stays consistent in both light and dark mode.

FAQs

Get new components in your inbox

Component drops, new themes and release notes. No spam, and you can unsubscribe from any email.

© 2026 ai2 design system · MIT licensed · Built with its own components