Card
A container that groups related content and actions in a structured, elevated surface.
Usage
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
CardFooter,
} from "@/components/ui/card"<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardContent>
<p>Content goes here.</p>
</CardContent>
<CardFooter>
<Button>Action</Button>
</CardFooter>
</Card>Examples
Simple card
<Card className="w-80">
<CardHeader>
<CardTitle>Notifications</CardTitle>
<CardDescription>You have 3 unread messages.</CardDescription>
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground">Check your inbox to stay up to date.</p>
</CardContent>
</Card>With action in header
Use CardAction to place an action (button, badge, etc.) in the top-right corner of the header.
<Card className="w-80">
<CardHeader>
<CardTitle>Team</CardTitle>
<CardDescription>Manage your team members.</CardDescription>
<CardAction>
<Button variant="outline" size="compact">Invite</Button>
</CardAction>
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground">3 members · 1 pending invite</p>
</CardContent>
</Card>With footer actions
<Card className="w-80">
<CardHeader>
<CardTitle>Delete account</CardTitle>
<CardDescription>This action cannot be undone.</CardDescription>
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground">All your data will be permanently removed.</p>
</CardContent>
<CardFooter className="gap-2">
<Button variant="outline" size="compact">Cancel</Button>
<Button variant="destructive" size="compact">Delete</Button>
</CardFooter>
</Card>Last updated on