Join our Discord Community

Card

Displays a card with header, content, and footer.

Loading component...

Installation

npx shadcn@latest add card

Usage

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

export function CardDemo() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Card Title</CardTitle>
        <CardDescription>Card Description</CardDescription>
        <CardAction>Card Action</CardAction>
      </CardHeader>
      <CardContent>
        <p>Card Content</p>
      </CardContent>
      <CardFooter>
        <p>Card Footer</p>
      </CardFooter>
    </Card>
  )
}

Examples

Simple Card

Basic card structure with all components:

Loading component...

Card with Form

Card containing form elements for user input:

Loading component...

Card with Action

Card with action button in header:

Loading component...

Stats Cards

Dashboard-style cards for displaying metrics:

Loading component...

Product Card

E-commerce product card with image and actions:

Loading component...

Profile Card

User profile card with avatar and information:

Loading component...

API Reference

Card

The root container for the card component.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Card content (header, body, footer).

CardHeader

Container for card title, description, and optional action.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Header content (title, description, action).

CardTitle

Primary heading for the card.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Title content.

CardDescription

Secondary text providing additional context.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Description content.

CardAction

Optional action element positioned in the header.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Action content (buttons, links).

CardContent

Main content area of the card.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Main card content.

CardFooter

Footer section for actions or additional information.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for styling.
childrenReact.ReactNode-Footer content (buttons, links, text).

Card best practices

What makes cards feel polished and professional:

  • Consistent spacing - Use the same padding and gaps across all your cards
  • Clear hierarchy - Title, description, and actions should have obvious importance levels
  • Logical action placement - Quick actions in headers, primary actions in footers
  • Responsive grids - Cards should stack nicely on mobile, spread on desktop
  • Appropriate shadows - Subtle elevation helps cards feel interactive
  • Loading states - Show skeleton placeholders while content loads
  • Touch-friendly targets - Make interactive cards easy to tap on mobile
  • Semantic structure - Use proper heading levels for screen readers