Skip to content

Design system

Documentation

DesignComponents / Card

Components / Card

Beta

Card

Use Card for a bounded content surface with a clear heading, body, and optional action area.

On this page

Examples

Simple content

A bounded surface gives one related idea a clear visual home.

Usage this month

Keep the summary and its next action together.

18,420 events

12% more than last month.

Card with header, description, and content

Grouped actions

Actions remain real buttons or links in the footer.

Draft release

Two actions with clear emphasis.

Card with grouped actions

Form surface

Cards can frame a form while Field keeps labels and validation connected.

Invite a teammate

Send an invitation to the workspace.

Card framing a form

Long content

Long lists use their own scroll region instead of clipping the surface.

Recent activity

Automation run 1 completed successfully.

Automation run 2 completed successfully.

Automation run 3 completed successfully.

Automation run 4 completed successfully.

Automation run 5 completed successfully.

Automation run 6 completed successfully.

Automation run 7 completed successfully.

Automation run 8 completed successfully.

Card with bounded long content

When to use

Use Card for a related set of content that benefits from a visual boundary. Use a plain section when grouping alone is enough, and use a Dialog when the task needs a temporary modal surface.

Usage

card-basic.tsx
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@phuctech/ui/components/card";

export function Example() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Usage this month</CardTitle>
        <CardDescription>Keep the summary and its next action together.</CardDescription>
      </CardHeader>
      <CardContent>18,420 events</CardContent>
    </Card>
  );
}

Composition

Use CardHeader for the title and description, CardContent for the primary information, and CardFooter for actions. Omit a region when it does not apply; do not add empty padding wrappers.

Clear hierarchy

Keep one primary heading and place the next action in the footer.

Not a catch-all

Do not nest a full page, unrelated cards, or long unbounded lists inside one Card.

API

Component API
PropTypeDefaultDescriptionConstraints
CardHTMLDivElement propsThe bounded surface and its border/elevation contract.Use a semantic heading inside when it represents a distinct region.
CardHeaderHTMLDivElement propsHeading and supporting metadata region.Keep the primary title in CardTitle.
CardTitleHTMLHeadingElement propsThe card heading.Use a meaningful heading level for the page hierarchy.
CardDescriptionHTMLParagraphElement propsShort supporting context.Do not put required instructions only in this low-emphasis text.
CardContent / CardFooterHTMLDivElement propsBody and action regions.Use the footer for actions, not for unrelated metadata.

Tokens

Component tokens
TokenRoleEffective valueUsage
--color-bg-surfaceSurfacesemantic card backgroundSeparates the card from the page without a hard-coded color.
--radius-xlSurface geometryshared large radiusGives content surfaces a consistent boundary.
--elevation-smSurface depthshared small shadowAdds a quiet layer of depth; avoid stacking arbitrary shadows.

Accessibility

  • Use a heading inside a Card when it introduces a distinct region.
  • Keep actions as real buttons or links; the Card itself is not interactive by default.
  • Long content needs its own bounded, scrollable region rather than clipping the Card.

Do and don’t

Do

Use Card to make related content easier to scan and keep its heading hierarchy intact.

Don’t

Use nested borders to imitate a table or make every paragraph look like a separate surface.

  • Badge adds a short state label inside a Card.
  • Dialog is the temporary, focus-managed surface for a task.
  • Elevation documents surface layers and shadows.