Skip to content

    Card

    Bordered surface for grouping related content. Uses radius-container and a border; no shadow (shadows are for floating layers only).

    React

    Preview

    Project

    Last edited 2 hours ago.

    Design tokens and components for teams building with AI.

    Props

    • variant
    • size
    • header
    • action
    • footer
    import { Button } from "@/components/ui/button"
    import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card>
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
      <CardFooter>
        <Button variant="secondary">Cancel</Button>
        <Button>Save</Button>
      </CardFooter>
    </Card>

    Usage

    When to use

    • Group related content about one subject, such as a project with its title, a short description and its actions.
    • Give the group a header, a body and at most one main action, in the footer.

    When not to use

    • A single line of text or a lone value. Use a list row.
    • Content that is already inside a card. Use a divider or spacing instead.
    • A surface that acts as one button. Card is not a button; to make the whole card clickable, stretch one link over it and put no other buttons or links inside.

    Platform support

    What each platform has, from the spec. A selected platform is highlighted.

    NameWebiOSAndroidNote
    variantYesYesYes
    sizeYesDeferredDeferredNot generated for iOS and Android. Deferred on iOS and Android: sm, md.
    value of size: smYesDeferredDeferred
    value of size: mdYesDeferredDeferred
    titleNoYesYesOnly on iOS, Android.
    descriptionNoYesYesOnly on iOS, Android.
    footerNoYesYesOnly on iOS, Android.

    Variants

    variant

    Set on Card. outline is the bordered card on the page. sunken is a well on background-sunken that keeps the border, for a quieter group. Cards on the page never take a shadow.

    • Project

      Last edited 2 hours ago.

      Design tokens and components for teams building with AI.

      outlinedefault

    • Project

      Last edited 2 hours ago.

      Design tokens and components for teams building with AI.

      sunken

    import { Button } from "@/components/ui/button"
    import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card>
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
      <CardFooter>
        <Button variant="secondary">Cancel</Button>
        <Button>Save</Button>
      </CardFooter>
    </Card>
    <Card variant="sunken">
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
      <CardFooter>
        <Button variant="secondary">Cancel</Button>
        <Button>Save</Button>
      </CardFooter>
    </Card>

    size

    Set on Card. The padding of every part: md is spacing-xl, sm is spacing-lg for dense dashboards.

    • Project

      Last edited 2 hours ago.

      Design tokens and components for teams building with AI.

      sm

    • Project

      Last edited 2 hours ago.

      Design tokens and components for teams building with AI.

      mddefault

    import { Button } from "@/components/ui/button"
    import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card size="sm">
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
      <CardFooter>
        <Button variant="secondary">Cancel</Button>
        <Button>Save</Button>
      </CardFooter>
    </Card>
    <Card>
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
      <CardFooter>
        <Button variant="secondary">Cancel</Button>
        <Button>Save</Button>
      </CardFooter>
    </Card>

    Examples

    Default

    Project

    Last edited 2 hours ago.

    Design tokens and components for teams building with AI.
    import { Button } from "@/components/ui/button"
    import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card>
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
      <CardFooter>
        <Button variant="secondary">Cancel</Button>
        <Button>Save</Button>
      </CardFooter>
    </Card>

    With action

    Project

    Last edited 2 hours ago.

    Design tokens and components for teams building with AI.
    import { Button } from "@/components/ui/button"
    import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card>
      <CardHeader>
        <CardTitle>Project</CardTitle>
        <CardDescription>Last edited 2 hours ago.</CardDescription>
        <CardAction>
          <Button variant="secondary" size="sm">Share</Button>
        </CardAction>
      </CardHeader>
      <CardContent>Design tokens and components for teams building with AI.</CardContent>
    </Card>

    Sunken

    Usage

    1,240 requests this week.

    import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card variant="sunken" className="w-full max-w-sm">
      <CardHeader>
        <CardTitle>Usage</CardTitle>
        <CardDescription>1,240 requests this week.</CardDescription>
      </CardHeader>
    </Card>

    Small

    Tighter padding for dense dashboards.

    Revenue

    Up 12% from last month.

    import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
    
    <Card size="sm" className="w-full max-w-sm">
      <CardHeader>
        <CardTitle>Revenue</CardTitle>
        <CardDescription>Up 12% from last month.</CardDescription>
      </CardHeader>
    </Card>

    With media

    Launch notes

    What shipped in October.

    import { Card, CardDescription, CardHeader, CardMedia, CardTitle } from "@/components/ui/card"
    
    <Card className="w-full max-w-sm">
      <CardMedia>
        <div className="h-32 bg-background-sunken" />
      </CardMedia>
      <CardHeader>
        <CardTitle>Launch notes</CardTitle>
        <CardDescription>What shipped in October.</CardDescription>
      </CardHeader>
    </Card>

    Do and don't

    Do

    • Use Card to group related content. Give it one primary action at most, in the footer.
    • To make the whole card clickable, stretch one link over it, use color-overlay-hover on hover and show the focus ring on the card. Then don't put any other button inside.
    • Use a border, not a shadow. Shadows are for menus, popovers and dialogs.

    Don't

    • Don't put a card inside a card. Use a divider (color-border) or spacing instead.
    • Don't use a card for a single line of text or a lone value. Use a list row.
    • Don't restyle the fill through className. If the surface color is wrong, open an issue instead of overriding it.

    Props

    NameTypeValuesDefaultDescription
    variantenumoutline | sunkenoutlineSet on Card. outline is the bordered card on the page. sunken is a well on background-sunken that keeps the border, for a quieter group. Cards on the page never take a shadow.
    sizeenumsm | mdmdSet on Card. The padding of every part: md is spacing-xl, sm is spacing-lg for dense dashboards. Not generated for iOS and Android. Deferred on iOS and Android: sm, md.
    titlenode--Native only: the heading in the header, medium weight, primary text. Only on iOS, Android.
    descriptionnode--Native only: supporting text under the title. Needs title. Only on iOS, Android.
    footernode--Native only: a row of actions or meta at the bottom. Only on iOS, Android.

    Not generated: CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter, CardMedia.

    Slots

    NameRequiredDescription
    headernoOptional header: title, description, and an optional CardAction.
    contentyesMain body content.
    footernoOptional footer actions or meta.

    Anatomy

    PartDescription
    rootThe card surface: border, radius-container, background-surface.
    headerTop block for title and description. Becomes a two-column grid when it holds an action.
    actionOptional slot at the top right of the header (a button or menu), next to the title and description.
    titlePrimary label of the card.
    descriptionSupporting text under the title.
    contentMain body of the card.
    footerActions or meta row at the bottom.
    mediaOptional full-bleed image or video at the top (CardMedia), meeting the border and the top corners.

    Accessibility

    Role: generic

    • Root is a plain div with no role. If a card needs to be announced as a group, add role="group" and aria-labelledby pointing at the CardTitle at the call site.
    • Card is not interactive by itself. Put buttons and links inside; do not make the whole card a button.
    • If the whole card is clickable, use one link stretched over the card (an ::after on the link with absolute inset-0; the root is relative) and no other buttons or links inside.
    • Title should be a heading level that fits the page outline (h2 or h3 in most views).

    Install

    npx werewolf-ui add card

    Run npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.