Components / surfaces

Card

A frame around content it does not own.

Rendered from the package · open on its own

Summary

A frame around content it does not own.

APG patternnone
Built onnative elements
Statusstable
Since0.2.0
<Card>
  <img data-part="media" data-se-layout="frame" src={cover} alt="" />
  <div data-part="body">
    <h3 data-se-text="crosshead">Northlight</h3>
    <p data-se-text="body">Twelve images, shot over two winters.</p>
  </div>
</Card>

<Card header={<Header title="Projects" count={12} level={2} action={<Button size="sm">Add</Button>} />} footer={<Link href="/projects">All projects</Link>}>
  <Rows items={projects} />
</Card>

The second form is a section: a Card with a Header in its header slot, the children as its body. crosshead is the card title's role — the smallest heading, at the lg step. This example reached for heading before that rung existed, and a 2xl page-section title read oversized on a tile.

Anatomy

An <article> by default, carrying data-se="card". Every part is a direct child. media, header and footer are slots that the binding fills from the props of the same names; body and action are the caller's. With no slot in use, every part is the caller's and the children render as written — the markup a card rendered before 0.8 renders the same way. Once a slot is passed, the children are the body.

PartElementRequired
actionthe caller'sthe caller's
body<div>no
footer<div>no
header<div>no
media<div>no

media bleeds to the frame and clips to its radius. header is the row above the body, with a hairline under it. body is padded. footer is pushed to the bottom, so cards in a row keep their footers on one line whatever the bodies above them do. action marks the one link an interactive card stretches.

Every rule uses the child combinator. Part 3.3 is open, and a descendant selector would dress a nested component's own footer or body.

Properties

PropertyValuesDefaultWhat it does
interactivebooleannoneThe whole card becomes one click target for the link marked data-part="action". The link stays the only focusable thing and keeps its own accessible name; the card draws the focus ring on its behalf. Without this, a card is inert and any number of controls inside it behave normally.
overflowclip · visibleclipWhether the frame clips what reaches past it. clip by default, so media meets the radius. visible for a card that holds something which must escape the frame — a Menu's floater, a Tooltip — and has no media to clip; written as data-overflow="visible".
askeyof React.JSX.IntrinsicElementsnoneThe element to render. article by default, because a card is usually a self-contained composition. Use li inside a list, or div where neither fits.
mediaReact.ReactNodenoneFills data-part="media": the region that bleeds to the frame's edge and clips to its radius. An image, usually; put data-se-layout="frame" on it when the ratio has to hold.
headerReact.ReactNodenoneFills data-part="header": the row above the body, with a hairline under it. A Header is the usual content — a section is a Card with a Header here.
footerReact.ReactNodenoneFills data-part="footer": pushed to the bottom, so cards in a row keep their footers on one line whatever the bodies above them do.
childrenReact.ReactNodenoneThe card's contents. With no slot in use they render as written and the parts are opt-in, as they always were. Once media, header or footer is passed, the children are the body — padded, in data-part="body" — as Dialog's children are its body.

States

StateExpressed as
Focused:focus-visible
Hover:hover

Hover and focus apply only to an interactive card. An inert one has no states at all.

Behavior

None of its own. An interactive card is a positioning context for the link inside it, and the link does the work.

Accessibility

The stretched link is the whole accessibility story. data-interactive makes the card a positioning context and the link marked data-part="action" covers it with a pseudo-element. The link stays the only tab stop and keeps its own accessible name.

Never wrap a card in an anchor. A reader then hears one link whose name is every word inside, and any button within it becomes interactive content nested in a link, which is invalid.

Never put the click on the frame. A div with a handler is not reachable by keyboard.

The card draws the focus ring via :has(), because a reader cannot see the edges of a stretched link.

Heading level is the caller's. Only the page knows whether a card's heading is an h2 or an h3, which is why there is no title prop. The header slot takes a Header, whose level the caller sets for the same reason.

Keyboard

None of its own. An interactive card's link is a normal tab stop; an inert card takes no keys.

Roles, states and properties

_None written. The elements carry their own._

Focus

The card draws the ring for the link inside it. The stretched link has no visible edges, so a ring on the link itself would appear in the wrong place. The link keeps the focus; the card only shows it.

Screen reader

Not recorded as verified. Stage 4 of the readiness ladder — driving each component with VoiceOver and NVDA — is unstarted across the package, and no component should claim otherwise until docs/journal/ records the session that did it.

Contrast and target size

npm run check:contrast audits every color pair this component uses across all four skins, light and dark, and fails the build on a shortfall. Two waivers are on the record in docs/audit/DEFERRED.md.

It sets no target size of its own; anything interactive inside it brings its own.

Tested

  • test/apg/card-header.test.jsx
  • test/apg/panel-regions.test.jsx
  • test/apg/rows.test.jsx
  • test/browser/card-header.spec.mjs
  • test/browser/card.spec.mjs
  • test/browser/control-width.spec.mjs
  • test/browser/layers.spec.mjs
  • test/browser/page-specimens.spec.mjs
  • test/browser/site.spec.mjs
  • test/browser/skin-scheme.spec.mjs

Known gaps

_No upstream requirement is recorded as not applicable._

Appearance

TokenUsed for
--se-borderborder, border-block-end, border-block-start
--se-border-widthborder, border-block-end, border-block-start
--se-duration-instanttransition
--se-ease-standardtransition
--se-focus-coloroutline
--se-focus-offsetoutline-offset
--se-focus-widthoutline
--se-radius-cardborder-radius
--se-space-2gap, padding-block-start
--se-space-3gap, padding
--se-space-5padding
--se-surfacebackground
--se-surface-sunkbackground
--se-textcolor

No shadow. 3.5 reads elevation as an obligation about dismissal, and a card sits in the flow and dismisses nothing.

The frame clips by default, so media meets the radius. overflow="visible" turns that off for a card with no media that holds something which must escape — a Menu's floater, a Tooltip. hosting-event built its sections by hand because the frame clipped them.

Motion

Background color crosses --se-duration-instant on hover, and only on an interactive card. Nothing lifts and nothing scales — a card that grows under the pointer moves every card beside it in a grid.

Content

The words are the caller's. What the frame asks for is that the heading names the thing rather than describing it: Northlight, not A case study about Northlight.

An interactive card's link text is what a reader hears in a list of links, so it has to make sense read alone.

Usage

It is a container, not a schema. A card that named its contents — title, description, image — would have to choose their markup, and it would grow a prop for every layout anyone wanted. Configure the very common, compose the rest.

Where the stretched link stops. The pseudo-element covers the card, so text inside an interactive card cannot be selected with a mouse. If the content is something a reader will copy — an address, a key, a quote — make the card inert and link the heading normally.

A section is a Card with a Header in its header slot — the builder's and hosting-event's section frames, which each app drew by hand. Set overflow="visible" when the section holds a menu or a tooltip, and leave it clipped when it holds media.

The three slots take the three regions. A Header in header, a Body as the children, a Footer in footer: the panel template, and the card draws the padding and the rules around them. Each is optional, and a card with none of them renders as it always did. A Body that is flush reaches the frame: the card drops the padding on all four sides of its body part, so a DataTable, a chart or media runs to the header's line and to the card's edges. A Rows list is not flush: its rows have no inset of their own and sit inside the card's padding.

It fills its cell's block size. Cards in a row keep their footers level because each card is as tall as its grid cell, not as tall as its content. A page that centers a single card — a sign-in, an empty state — places the card in a cell that is sized to its content: a wrapper, or place-items: center on a grid that gives the card its own cell. Put the card straight into a tall centering container and it takes the container's whole height, and there is nothing to center. Measured on the auth page specimen.

When not to use it. If the content is the page rather than one of many things on it, a heading and a Separator say so better than a border does.

Notes

A schema Card was rejected on three grounds, in the order they bind here: it could not ship as anatomy, so a Vue or Astro consumer would get nothing; it would have to pick a heading tag; and it could not express the stretched link at all.

media is new to the part vocabulary. It names the region that bleeds to a frame's edge, and nothing else in the system had one.

The slots arrived in 0.8 without changing what a slotless card renders (the owner's word, 15 Oct 2026). media, header and footer fill the parts of the same names, and the children become the body only once a slot is in use — the same split Dialog has had since 0.1. A body prop was not added: it would answer the same question as the children, and two props answering one question is how variant went wrong. overflow is a value axis, not a noClip boolean, because a third value — a scroll region — is a plausible next ask and a boolean cannot take it.

The card pads --se-space-5 (14 Nov 2026). It padded --se-space-4, one step inside the conventions' own rule: space-5 is the step between a group and its container's edge, and names card padding. The body pads it on every side, the header and footer at their sides.