Skip to main content
The Card component serves as a versatile container for grouping related content. It provides a structured layout with optional header, content, action, and footer areas.

Installation

npx shadcn@latest add @eo-n/card

Usage

Import the Card components and compose them together:
import {
  Card,
  CardAction,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";
<Card>
  <CardHeader>
    <CardTitle>Product 1</CardTitle>
    <CardDescription>Product description</CardDescription>
    <CardAction>Product action</CardAction>
  </CardHeader>
  <CardContent>
    <p>Product Content</p>
  </CardContent>
  <CardFooter>
    <p>Product Footer</p>
  </CardFooter>
</Card>

Component API

Card

The root container component.
flush
boolean
default:"false"
When true, removes default padding and adjusts header/footer styling for a flush layout.
className
string
Additional CSS classes to apply to the card.

CardHeader

Container for the card’s header content, including title, description, and actions.
className
string
Additional CSS classes to apply to the header.

CardTitle

Displays the main heading for the card.
className
string
Additional CSS classes to apply to the title.

CardDescription

Displays secondary descriptive text below the title.
className
string
Additional CSS classes to apply to the description.

CardAction

Container for action elements (buttons, icons) positioned in the top-right corner of the header.
className
string
Additional CSS classes to apply to the action container.

CardContent

Main content area of the card.
className
string
Additional CSS classes to apply to the content.

CardFooter

Footer area for additional actions or information.
className
string
Additional CSS classes to apply to the footer.

Examples

Basic Card

<Card>
  <CardHeader>
    <CardTitle>Welcome</CardTitle>
    <CardDescription>Get started with your dashboard</CardDescription>
  </CardHeader>
  <CardContent>
    <p>Your main content goes here.</p>
  </CardContent>
</Card>

Card with Action

<Card>
  <CardHeader>
    <CardTitle>Settings</CardTitle>
    <CardDescription>Manage your preferences</CardDescription>
    <CardAction>
      <Button variant="ghost" size="sm">Edit</Button>
    </CardAction>
  </CardHeader>
  <CardContent>
    <p>Settings content here.</p>
  </CardContent>
</Card>

Flush Card

<Card flush>
  <CardHeader>
    <CardTitle>Flush Layout</CardTitle>
    <CardDescription>No padding on the card itself</CardDescription>
  </CardHeader>
  <CardContent>
    <p>Content extends to the edges.</p>
  </CardContent>
  <CardFooter>
    <Button>Action</Button>
  </CardFooter>
</Card>

Build docs developers (and LLMs) love