Card

A content container that groups related information. Cards separate from the page by surface colour rather than a border: a recessed tray on the page, a raised surface on a tray section.

StableSource

Usage

Usage resets on the first of each month.

Import

tsx
import { Card } from "@merid/react";

Examples

Variants

tray (default) is the recessed card for use directly on the page. outline is a hairline card for when a tray would clash with its surroundings.

Tray

Usage resets on the first of each month.

Outline

Usage resets on the first of each month.

Elevated, on a tray section

elevated is surface plus a soft shadow. Use it when the card sits on a tray Section. A tray card inside a tray section flips to this look automatically.

Elevated

Usage resets on the first of each month.

Padding

none 0, sm 20px, md 28px (default), lg 32px. Use none when the card holds a full-bleed image or table.

sm · 20px

md · 28px

lg · 32px

Interactive and selected

interactive adds a 3px hover lift and a pointer cursor; use it when the whole card is a link or button, and render it as that element with as. selected draws the 1.5px accent ring.

API reference

Renders a div unless as is given; forwards its ref and passes all HTML attributes through.

PropTypeDefaultDescription
variant"tray" | "elevated" | "outline""tray"Surface. tray on the page, elevated on a tray section, outline is a hairline card.
padding"none" | "sm" | "md" | "lg""md"Inner padding: 0, 20px, 28px, 32px.
interactivebooleanfalseAdds hover lift (3px) and pointer cursor. Use when the whole card is a link or button.
selectedboolean–Draws the 1.5px accent selection ring. On an `interactive` card rendered `as="button"` it also sets `aria-pressed`; otherwise it is visual only.
asElementType"div"Element or component to render instead of a div.

Styling

HookValues
.mrd-cardRoot element
data-varianttray · elevated · outline
data-paddingnone · sm · md · lg
data-interactivePresent when interactive
data-selectedPresent when selected

Component variable: --mrd-card-padding, set per data-padding.

css
.pricing .mrd-card {
  --mrd-card-padding: var(--mrd-space-10);
}

Accessibility

  • A card has no role of its own. Give a group of cards a heading, and start each card with a heading at the right level.
  • For a clickable card, render it as the interactive element (as="a" or as="button") rather than wrapping a div in an onClick.
  • selected sets aria-pressed only when the card is interactive and rendered as="button" (a toggle button). Otherwise it is visual only: convey the state with aria-current on a link, or a checked control.

Guidelines

Do

Match the surface to the background: tray cards on the page, elevated cards on a tray section.

Avoid

Add borders and shadows to a tray card to make it “pop”, or nest cards more than one level deep.

  • Section — tray bands that change how cards look.
  • Grid — lays out rows of cards.
  • EmptyState — placeholder for an empty card list.