Basel Standard / Docs
Card
Surface primitive that keeps standard card imports while adding stronger editorial rhythm.
Card
Keep familiar shadcn card imports while adding more expressive subcomponents.
Cards are the system's repeatable surface primitive. They provide edge, spacing, and typographic hierarchy for places where content needs to feel grouped and intentional, whether that content is editorial copy, product metadata, or a compact utility workflow.
Installation
Purchase access, then open /account/install to issue a registry token.Usage
import { Card, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"
<Card>
<CardHeader>
<CardTitle>System Surface</CardTitle>
<CardDescription>Structure before decoration.</CardDescription>
</CardHeader>
</Card>
Why This Primitive Exists
The Swiss card keeps the familiar shadcn import story, but it adds a stricter content rhythm so cards can scale from plain utility panels to more art-directed shelves.
- Use a card when a section needs a visible frame and repeatable internal spacing.
- Reach for card subcomponents before hand-rolling local title, meta, and footer patterns.
- Change
variantortoneto fit the surface, not to compensate for weak content hierarchy.
Examples
Variant Overview
The base card works well for standard UI, while the repo-specific variants tune the surface for denser data panels, editorial modules, or action-driven utilities.
Default
Use when the card should inherit the page rhythm.
Data
Lets nested metrics and filters read clearly.
Action
Useful when buttons and metadata live together.
| Variant | Use it for |
|---|---|
default | General-purpose docs, settings, and neutral product surfaces. |
editorial | Story-led cards where typography and spacing should feel more authored. |
data | Denser dashboards or metrics panels that need lower visual temperature. |
form | Input-heavy sections that need structure around a task. |
media | Cards with a dedicated media rail or image region. |
action | Prompt cards where the footer or CTA cluster is the main outcome. |
Composition With Media And Actions
The exported subcomponents are meant to be combined. CardMedia, CardPrice, and CardActions let a product or launch card stay within the same primitive instead of branching into a separate bespoke layout.
Commerce composition
This keeps the same primitive usable on a catalog shelf without inventing a separate surface language.
import {
Card,
CardActions,
CardContent,
CardHeader,
CardMedia,
CardPrice,
CardTitle,
} from "@/components/ui/card"
import { Button } from "@/components/ui/button"
<Card variant="media">
<CardMedia />
<CardHeader>
<CardTitle>Grid Chair</CardTitle>
</CardHeader>
<CardContent>
<CardPrice>$420</CardPrice>
<CardActions>
<Button>Add to cart</Button>
<Button variant="outline">See details</Button>
</CardActions>
</CardContent>
</Card>
In Context
Cards become more useful when they show relationship, not just isolation. Pair an editorial summary card with a quieter supporting panel so adjacent content can share the same visual grammar without feeling duplicated.
Launch note
The same title rhythm can hold a story summary while the footer collects the next actions.
Supporting metrics
<Card variant="data" tone="hero">
<CardHeader>
<CardTitle>Supporting metrics</CardTitle>
</CardHeader>
<CardContent>{/* compact metrics or filters */}</CardContent>
</Card>
Guidance
Start With Content Structure
- Use
CardHeaderfor identity, not just decoration. - Keep
CardTitleshort enough to hold an intentional line length. - Put metadata in
CardMetaorCardEyebrowso the title can stay focused on the main idea.
Choose Variant Before Tone
- Pick
variantbased on the kind of surface you are building. - Use
tone="quiet"ortone="hero"as a secondary adjustment after the structure is right. - Reserve
tone="inverse"for genuinely dark or image-heavy environments.
Prefer Reuse Over One-Off Layouts
- If a card needs pricing, actions, or media, use the exported slots before creating a custom wrapper.
- Keep footer actions concise; a card is a container, not a full page.
- When content can sit directly on the page without losing clarity, skip the card entirely.
API Reference
Card
The root Card component renders a div and accepts standard React.ComponentProps<"div"> plus the shared surface variants below.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "editorial" | "data" | "form" | "media" | "action" | "default" |
tone | "default" | "quiet" | "hero" | "inverse" | "default" |
Exported Slots
Use the slot components to keep hierarchy consistent instead of re-creating local typography rules.
| Export | Renders | Notes |
|---|---|---|
CardHeader | div | Top section with the default card divider and padding. |
CardTitle | div | Uppercase headline with a constrained line length. |
CardDescription | p | Supporting copy for the main card idea. |
CardEyebrow | p | Small uppercase label for category or state. |
CardMeta | div | Compact metadata row for tags, dates, or attributes. |
CardContent | div | Main body area for copy, lists, or controls. |
CardFooter | div | Bottom action rail with the default divider. |
CardAction | div | Small action cluster usually placed inside the header. |
CardActions | div | Flexible button row inside content sections. |
CardPrice | div | Large price or numeric emphasis. |
CardMedia | div | Framed media area with an aspect ratio and border. |