Layout tokens

How a card gets its edge, its fill and its padding, and the class strings the kit shares between overlays and titles.


Cards

A Card draws the edge, the radius and the fill, and has no padding. Each part inside it pads itself, 16px at each side, so a hairline under a row runs to the card's edge.

On a card

A card built from its parts, with each part's padding marked.

Sessions
Devices signed in to your account.

Sign out of any you do not know.

MacBook ProThis device
iPhone 162 hours ago
iPad Air3 days ago

All parts

Every part that pads itself, including the ones this card does not use.

PartUsePadding
CardHeaderA title and description, with an optional CardAction at the far endpx-4 pt-5
CardContentThe body. Under a header it starts 8px down, or 16px when it holds a formpx-4 py-5
CardRows, CardRowA list with a hairline under each row. inset="flush" drops the sides inside CardContentp-4
CardTableHeaderColumn headings over rows laid out on a grid. Hidden in a card narrower than 28rempx-4 py-3
DashboardCardHeaderA 48px muted band with a title and an action. inset="loose" for a card of prosepx-4, loose px-6
CardFooterThe actions band. size="compact" and tone="muted" for a dense gridpx-4 pb-5, compact pb-3

Variants

variant picks the surface. featured is a separate switch that adds an accent ring to any of them. Keep a muted card to plain content.

Weekly steps

Goal: 50,000 steps

variant="default"

Card fill and a ring for its edge

Weekly steps

Goal: 50,000 steps

variant="dotgrid"

A faint dot grid, for staging live UI

Weekly steps

Goal: 50,000 steps

variant="muted"

A quiet fill, no ring or shadow

Weekly steps

Goal: 50,000 steps

featured

The recommended one in a set

One surface per box

A Card is already a surface, so nothing inside it paints a second one. A Table never goes inside a Card, even with surface="bare". Data in a card uses CardTableHeader and CardRows.

api-serverHealthy99.9%
web-appHealthy99.7%
workerDegraded97.2%

Usage

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

<Card>
  <CardHeader>
    <CardTitle>Weekly steps</CardTitle>
    <CardDescription>Goal: 50,000 steps</CardDescription>
  </CardHeader>
  <CardContent>47,291</CardContent>
</Card>

Shared class strings

Two class strings the kit parts share, exported from tokens. The older card strings (cardHeaderClass and its siblings) still export, but no kit part uses them: build cards from the parts above.

blurredOverlayClass

The backdrop behind Dialog, AlertDialog, Drawer and Sheet. It blurs the page with a light dim. Without backdrop-filter support or under reduced transparency the dim becomes 70% black, and 85% under high contrast.

fixed inset-0 z-50
bg-black/10 backdrop-blur-md
transition-opacity duration-large ease-large
data-[ending-style]:duration-small data-[ending-style]:ease-small
data-[starting-style]:opacity-0 data-[ending-style]:opacity-0
not-supports-backdrop-filter:bg-black/70
reduce-transparency:backdrop-blur-none reduce-transparency:bg-black/70
contrast-more:bg-black/85

truncatedTitleClass

A one-line title that ends in an ellipsis. A cap-trimmed box ends at the baseline, so truncate would cut every descender. This clips sideways only.

min-w-0 overflow-x-clip text-ellipsis whitespace-nowrap