Skip to content

Card

Flexible surface container for grouping related content with optional header, body, footer, and media slots.

  • stable
  • since v0.1.0
  • 1.6 kB
  • layout
  • container
  • surface

Rendered as a <div> by default; interactive mode adds tabIndex=0 for keyboard focus. Use asChild with an <a> or <button> for native semantics when the whole card is actionable.

Preview
Open
tsx

Use CardHeader, CardBody, and CardFooter for structured three-zone layouts.

Preview
Open
tsx

Pass interactive to add hover/focus styles and tabIndex=0. Use asChild to render the card as a native <a> or <button> for full semantics.

Preview
Open
tsx

Use CardMedia to wrap arbitrary media (images, video, or coloured placeholders) with consistent aspect-ratio sizing.

Preview
Open
tsx
PropTypeDefaultDescription
variant
"outlined"|"elevated"|"filled"|"ghost"
outlined
Visual treatment. `outlined` uses a border, `elevated` adds a shadow, `filled` paints a subtle surface tint, `ghost` is borderless.
size
"sm"|"md"|"lg"
md
Internal padding scale applied to the card and its standard parts.
orientation
"vertical"|"horizontal"
vertical
Lays children left-to-right (e.g. image beside body) instead of top-to-bottom.
interactive
boolean
false
Adds hover/focus affordances and a `tabIndex={0}` so the whole card is keyboard-focusable. Combine with an `onClick` or wrap in a link.
asChild
boolean
false
Render the props onto the immediate child via Slot composition instead of a wrapping `div`. Useful for turning the card into an `<a>` or `<button>`.
  • Rendered as a <div> by default — purely presentational.
  • interactive adds tabIndex=0 and focus ring styles for keyboard navigation, but the element still has no implicit role. For actionable cards, prefer asChild with an <a> (link cards) or wrap contents in a <button>.
  • Heading hierarchy inside CardTitle defaults to <h3> — override with the as prop to match the page’s document outline.
  • Use variant="elevated" for cards that float above the page surface.
  • Use orientation="horizontal" with CardImage horizontal for side-by-side image+content layouts.
  • Compose with Badge in the header for status indicators.
  • Nest Alert inside CardBody to show inline validation feedback within a card form.