Usage
import { Card, CardAction, cardAnatomy, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@desk/ui/components/card";Best practices
Compose structure with
CardHeader/CardContent/CardFooterrather than raw padded divs — the root supplies the gap rhythm and footer padding viadata-slotselectors.Pass
shadow={false}when stacking cards on amuted/shaded canvas — colour contrast separates them and per-card shadows read as noise.For a full-bleed media/CTA panel use an editorial composite (
EditorialCard), notCard—Cardis a neutral padded container, not a marketing surface.
Props
Card
| Prop | Type | Default | Description |
|---|---|---|---|
| border | BorderStyle | ||
| shadow | boolean | Whether the card casts a shadow. Defaults to true (each variant's own shadow). Set to false for flat cards on a shaded canvas — e.g. several cards stacked on a muted-background page/panel, where the color contrast alone separates them and a shadow on every one would be redundant. | |
| testId | string | ||
| variant | "muted" | "ghost" | "accent" | "card" | null | undefined |
CardContent
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | Merge props onto child |
CardHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | Merge props onto child | |
| border | boolean | Render a bottom border |
CardTitle
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | Merge props onto child |
Also exports
- component
CardAction - const
cardAnatomy - component
CardDescription - component
CardFooter
Anatomy
Card
cardContainer for grouped content
CardHeader
card-headerHeader area with title and optional action
CardTitle
card-titleMain heading
CardDescription
card-descriptionSubheading or summary
CardAction
card-actionAction button or link
CardContent
card-contentMain content area
CardFooter
card-footerFooter with actions or metadata
Composition
Used by