---
title: "Card"
description: "A bounded group of related content with a border and consistent padding is the ordinary box that most of a screen is made of."
url: "https://opsinjs.pensievelabs.org/docs/components/card"
source: "https://opsinjs.pensievelabs.org/docs/components/card.md"
section: "Components"
status: "shipped"
kind: "component"
category: "surfaces"
reviewed: "2026-09-20"
reviewer: "engineering"
aliases: ["panel", "container", "box", "tile group", "content box"]
governedBy: ["two-colour-axes"]
usedIn: ["result-disclosure", "onboarding-and-first-run", "trend-review"]
implemented: true
---

> Elements written as `<PascalCase … />` below are opsinjs documentation
> components. Their attributes are the content: the values they render are
> generated from `tokens/*.json` and `registry/catalogue.ts` and are
> published separately at https://opsinjs.pensievelabs.org/r/index.json and under the Reference
> section.
> `<StubNotice>` IS THE EXCEPTION, AND IT IS THE ONE TO READ. It is a
> paired element rather than a self-closing one, and the text between
> its opening and closing tags is prose an author wrote, reproduced
> below word for word. That prose is where this page says whether the
> component has been reviewed. Read the children, not only the
> attributes.

<StubNotice
  name="card"
  status="shipped"
  questions="[
  &#x22;A link card may hold no other interactive element, but the rule is stated, not enforced: TypeScript and a runtime walk both miss wrapped controls.&#x22;,
  &#x22;Nested cards are announced no differently from unnested ones, and how deep is acceptable is unanswered.&#x22;,
  &#x22;A link card's accessible name is its whole text content; whether Card should offer a way to name the link is open.&#x22;,
]"
>
  Audited against WCAG 2.2 AA. Clinical review pending.
</StubNotice>

## Usage [#usage]

<ComponentInstall name="card" unbuilt="false" importPath="@/components/ui/card" dependencies="[&#x22;lucide-react&#x22;]" registryDependencies="[&#x22;surface&#x22;]" />

```tsx
import { Card } from "@/components/ui/card"
```

```tsx
<Card>
  <Card.Header title={<h3>Recent readings</h3>} />
  <Card.Body>Card content</Card.Body>
</Card>
```

## Examples [#examples]

<ComponentPreview name="card" />

### The whole card as one link [#the-whole-card-as-one-link]

`href` makes the card one anchor and one tab stop. A chevron marks it at rest,
the title underlines on hover, and it holds no buttons.

<ComponentPreview name="card-as-a-link" kind="example" align="start" />

### Cards on a sheet, and the rung that stays put [#cards-on-a-sheet-and-the-rung-that-stays-put]

The sheet is the layer; the cards on it stay on the `card` rung, since a
translucent rung never contains one.

<ComponentPreview name="card-on-a-sheet" kind="example" align="start" />

## When to use it [#when-to-use-it]

<WhenToUse
  use="[
  &#x22;Grouping content that belongs together and needs a visible boundary.&#x22;,
  &#x22;Giving a block its own padding, radius and rung so it reads as one thing, not a region of the page.&#x22;,
  &#x22;As the base for a purpose-built card with its own contract, the way ResultCard and CareCard are.&#x22;,
]"
  avoid="[
  { case: &#x22;The content is a health result with a value, range, status and meaning.&#x22;, instead: &#x22;result-card&#x22; },
  { case: &#x22;The content is an instruction the reader must act on.&#x22;, instead: &#x22;care-card&#x22; },
  { case: &#x22;The content is one measurement in a dashboard grid.&#x22;, instead: &#x22;metric-tile&#x22; },
  { case: &#x22;You need a layer over scrolling content that must stay readable.&#x22;, instead: &#x22;surface&#x22; },
  { case: &#x22;You want a border for advisory prose.&#x22;, instead: &#x22;callout&#x22; },
]"
/>

## Accessibility [#accessibility]

A card takes no role or name unless it is a link. It carries the page's heading level
in a title slot that resets font and margin, floors a link target at
`--opsin-target-minimum`, and keeps its edge under greyscale, `forced-colors` and print.
The resting chevron is `aria-hidden`, backed by the title underline and anchor as
redundant cues. There is no axe violation and no 320px reflow failure, and
`pnpm run check:a11y` confirms on every commit that every colour is a role token, no
type size is in `px`, and no banned word appears. The audit moved the link card's
`focus-visible` ring from a hardcoded 2px outline to `--opsin-border-focus` and
`--opsin-border-focus-offset`, so a product raising those gets a wider ring here, and
the default stays 2px. A link card sinks to 0.98 when pressed and comes back on the
standard curve, never on a spring, because a card can hold a reading.

**Residual items.** A link card is one anchor, so its accessible name is all its text
at once. Weigh that verbosity before putting `href` on a long card.

<KeyboardTable
  name="card"
  rows="[
  {
    keys: &#x22;Tab&#x22;,
    action: &#x22;Moves to the card, when the card is a link&#x22;,
    notes: &#x22;One stop per card. A card without href is not focusable.&#x22;,
  },
  {
    keys: &#x22;Shift + Tab&#x22;,
    action: &#x22;Moves backwards to the card&#x22;,
    notes: &#x22;Reverse order matches visual order.&#x22;,
  },
  {
    keys: &#x22;Enter&#x22;,
    action: &#x22;Follows the link, on a card that has an href&#x22;,
    notes: &#x22;The root is a real anchor, so this is browser behaviour.&#x22;,
  },
  {
    keys: &#x22;Space&#x22;,
    action: &#x22;Scrolls the page&#x22;,
    notes: &#x22;A link activates on Enter, not Space.&#x22;,
  },
]"
/>

<ContrastReport component="card" />

## Props interface [#props-interface]

<PropsTable name="CardProps" />

`rung` defaults to `card`, not `raised`, and never goes above `raised`: a
translucent rung warns in development and renders. `render` takes the
router's link element, not a function, and does nothing without `href`. There is
no `status`, `variant`, `color` or `category`.

<PropsTable name="CardHeaderProps" />

<PropsTable name="CardBodyProps" />

<PropsTable name="CardFooterProps" />
