ComponentsData & surfaces
Card
Shared primitiveFrame one surface or one repeated object.
@/components/ui/card
Composition preview
Try Card alongside its related data & surfaces components. These examples keep all actions local.
| Post | Status |
|---|---|
| A small product update | Draft |
| A useful lesson | Approved |
Usage
import { Card } from "@/components/ui/card";
<>
<Card asChild className="gap-4 p-4 sm:p-6">
<section aria-labelledby="profile-title">
<h2 id="profile-title" className="text-base font-medium">Product knowledge</h2>
<p className="text-sm text-muted-foreground">What your sources tell us.</p>
</section>
</Card>
</>Composition recipe. Supply application state, handlers and persistence in the owning product component. Inspect the installed source before extending its API.
API & composition
CardHeader, CardTitle, CardDescription, CardContent, CardFooter, CardAction; size; asChild; cardFrameClassName; cardSurfaceClassName
Usage & accessibility
Use the shared blue-tinted bg-card surface, border-border and 8px corners. Major detail/editing panels use p-4 sm:p-6. LabPanel consumes the same frame; use cardSurfaceClassName only when an existing layout requires its own overflow contract. Avoid decorative nested cards.
Implementation contract
src/components/ui/card.tsx
Use named variants and semantic theme tokens. Preserve existing input values, refs, focus and cancellation behavior. Verify keyboard, narrow layouts and pending/error states when behavior changes.