Skip to documentation

ComponentsData & surfaces

Card

Shared primitive

Frame 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.

PEDraftScheduledPublished
Upcoming posts
A focused surface for related content.

Keep useful content in the card body.

Illustrative design-system records.
PostStatus
A small product updateDraft
A useful lessonApproved

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.

V-2026-11-14_17.03.42