Card
A container component for grouping related content with optional header and footer
Card Title
Card description goes here
Card content and body text.
A flexible container component for grouping related content. Cards can include headers, content areas, and footers for consistent layout patterns.
Installation
npx shadcn@latest add https://nteract-elements.vercel.app/r/card.jsonCopy from the nteract/elements registry.
Usage
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
CardFooter,
} from "@/registry/primitives/card"
export function Example() {
return (
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardContent>
<p>Content goes here.</p>
</CardContent>
<CardFooter>
<p>Footer</p>
</CardFooter>
</Card>
)
}Examples
Simple Card
A simple card with just content.
<Card>
<CardContent className="pt-6">
<p>A simple card with just content.</p>
</CardContent>
</Card>With Header Action
Notifications
You have 3 unread messages
Recent activity will appear here.
<Card>
<CardHeader>
<CardTitle>Notifications</CardTitle>
<CardDescription>You have 3 unread messages</CardDescription>
<CardAction>
<Button variant="outline" size="sm">View All</Button>
</CardAction>
</CardHeader>
<CardContent>
<p>Recent activity will appear here.</p>
</CardContent>
</Card>Notebook Examples
Cell Output
Execution completed in 0.42s
{"result": 42}<Card>
<CardHeader>
<CardTitle>Cell Output</CardTitle>
<CardDescription>Execution completed in 0.42s</CardDescription>
</CardHeader>
<CardContent>
<pre className="bg-muted p-2 rounded text-sm">{'{"result": 42}'}</pre>
</CardContent>
</Card>Props
Card
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |
CardHeader
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |
CardTitle
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |
CardDescription
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |
CardContent
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |
CardFooter
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |
CardAction
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | — | All standard div attributes |