Card
A surface that groups a header, content and actions. Glass in Kiri, hard-shadowed in Iwa.
Installation
Or with the shadcn CLI, from the registry:
Usage
An action in the header
CardAction sits at the end of the header, beside the title and description: a menu, a badge, a link.
Variants and sizes
default is a raised surface; outline keeps the border without the shadow, for cards in a list; ghost keeps only
the layout; elevated has a deeper shadow, for what stands above the rest. size="sm" tightens the padding and gaps of
every part.
Villages
The card is --card over the page: translucent with a blur in Kiri, with a 3px ink shadow in Iwa, whose title is in capitals.
Accessibility
- Plain
<div>s.CardTitleis a<div>too: when the card is a section of the page, render a heading inside it, or give the cardrole="region"and anaria-labelledby.
API reference
Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent and CardFooter, each a <div> taking its props and className. Card also takes:
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "ghost" | "elevated" | "default" |
size | "sm" | "default" | "default" |
cardVariants({ variant, size }) returns the card's classes.