Card
LayoutContainer with header, content, and footer slots. Used for stats, forms, and data panels.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
CardFooter,
} from "@dashboardpack/core/components/ui/card";
import { Button } from "@dashboardpack/core/components/ui/button";
import { useState } from "react";
export default function CardExample() {
const [joined, setJoined] = useState(false);
return (
<Card className="w-full max-w-sm">
<CardHeader>
<CardTitle>Your workspace</CardTitle>
<CardDescription>Everything your team needs to ship.</CardDescription>
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground">
12 projects · 8 team members
</p>
</CardContent>
<CardFooter>
<Button
onClick={() => setJoined(!joined)}
variant={joined ? "secondary" : "default"}
>
{joined ? "Joined workspace" : "Join workspace"}
</Button>
</CardFooter>
</Card>
);
}Usage
Compose CardHeader, CardTitle, CardDescription, CardContent, and CardFooter. Use cards to group one related set of information and its actions.
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
CardFooter,
} from "@dashboardpack/core/components/ui/card";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| className | stringDefault: — | Extend styles on any card slot. |
| children | ReactNodeDefault: — | Compose the header, content, and footer slots. |