Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Data display

Card

Free7.2 KB gzipped

A soft, rounded surface that groups related content. Compose it from Card.Media, Card.Header, Card.Title, Card.Description, Card.Body, and Card.Footer. For a fully clickable card, add one Card.LinkOverlay (or give Card.Title an href): the link stretches over the card while nested buttons stay independently clickable.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab · Full report

Import

tsx
import { Card } from "@vjdesigns/vjdesigns-ui";

Importing only Card adds about 7.2 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Basic

Compose a card from its parts. Card.Header lays out a title, description and an action.

Team plan

Billed yearly · Renews Jan 1

12 of 20 seats in use. Add seats any time; you're only charged for the rest of the term.

tsx
import {
  Button,
  Card,
  IconButton,
  MoreHorizontalIcon,
  Text,
} from "@vjdesigns/vjdesigns-ui";

export function Basic() {
  return (
    <Card style={{ width: "100%", maxWidth: "24rem" }}>
      <Card.Header
        title="Team plan"
        description="Billed yearly · Renews Jan 1"
        action={
          <IconButton aria-label="Plan options" variant="ghost" tone="neutral" size="sm">
            <MoreHorizontalIcon />
          </IconButton>
        }
      />
      <Card.Body>
        <Text tone="muted">12 of 20 seats in use. Add seats any time; you're only charged for the rest of the term.</Text>
      </Card.Body>
      <Card.Footer>
        <Button variant="ghost" tone="neutral">
          Manage
        </Button>
        <Button>Add seats</Button>
      </Card.Footer>
    </Card>
  );
}

Variants

Elevated

A raised surface with a soft shadow. The default.

Outline

A flat surface with a border.

Filled

A sunken, recessed surface.

Soft

Tinted with a tone, with text that stays readable.

tsx
import { Card, Grid } from "@vjdesigns/vjdesigns-ui";

export function Variants() {
  return (
    <Grid columns={{ base: 1, sm: 2 }} gap={4} style={{ width: "100%" }}>
      <Card variant="elevated">
        <Card.Title>Elevated</Card.Title>
        <Card.Description>A raised surface with a soft shadow. The default.</Card.Description>
      </Card>
      <Card variant="outline">
        <Card.Title>Outline</Card.Title>
        <Card.Description>A flat surface with a border.</Card.Description>
      </Card>
      <Card variant="filled">
        <Card.Title>Filled</Card.Title>
        <Card.Description>A sunken, recessed surface.</Card.Description>
      </Card>
      <Card variant="soft" tone="success">
        <Card.Title>Soft</Card.Title>
        <Card.Description>Tinted with a tone, with text that stays readable.</Card.Description>
      </Card>
    </Grid>
  );
}

Clickable with media

Give Card.Title an href (or use Card.LinkOverlay) to make the whole card clickable. Buttons inside stay separately clickable. interactive adds the hover lift.

tsx
import { Badge, Button, Card, Image } from "@vjdesigns/vjdesigns-ui";

export function ClickableWithMedia() {
  return (
    <Card interactive padding="md" style={{ width: "100%", maxWidth: "22rem" }}>
      <Card.Media>
        <Image src="/docs/mountains.svg" alt="Purple mountains at dusk under a low sun" />
      </Card.Media>
      <Card.Header
        title={<Card.Title href="#example-clickable-with-media">Sunset ridge trail</Card.Title>}
        description="8.4 km · Moderate"
        action={<Badge tone="success">Open</Badge>}
      />
      <Card.Footer justify="start">
        <Button size="sm" variant="soft">
          Save trail
        </Button>
      </Card.Footer>
    </Card>
  );
}

Horizontal

orientation="horizontal" puts media beside the content, and collapses to a column when the card is narrow.

A sandy beach beside a calm blue sea

Coastal weekend

Two nights · From $240

A quiet cabin a short walk from the beach, with bikes and kayaks included.

tsx
import { Card, Image, Text } from "@vjdesigns/vjdesigns-ui";

export function Horizontal() {
  return (
    <Card orientation="horizontal" variant="outline" style={{ width: "100%", maxWidth: "36rem" }}>
      <Card.Media position="start" aspectRatio="1/1">
        <Image src="/docs/coast.svg" alt="A sandy beach beside a calm blue sea" />
      </Card.Media>
      <Card.Header title="Coastal weekend" description="Two nights · From $240" />
      <Card.Body>
        <Text tone="muted" size="sm">
          A quiet cabin a short walk from the beach, with bikes and kayaks included.
        </Text>
      </Card.Body>
    </Card>
  );
}

Accessibility

The whole card is clickable, but there's only one link: Card.LinkOverlay stretches the title's link over the card, so screen readers hear a single link named "Quarterly report" rather than a card full of nested links. level keeps the heading outline right.

tsx
import { Card } from "@vjdesigns/vjdesigns-ui";

export function Accessibility() {
  return (
    <Card variant="outline" padding="md" interactive style={{ width: "100%", maxWidth: "22rem" }}>
      <Card.Title level={3} size="lg">
        <Card.LinkOverlay href="#reports" onClick={(event) => event.preventDefault()}>
          Quarterly report
        </Card.LinkOverlay>
      </Card.Title>
      <Card.Description>Revenue, churn and support volume for July to September.</Card.Description>
    </Card>
  );
}

Translated

In Arabic the card mirrors: the header's action moves to the left and the footer's buttons line up from the right. The text is your own.

الفاتورة الشهرية

مستحقة في 1 نوفمبر

قيد الانتظار
tsx
import { Badge, Button, Card, LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

export function Translated() {
  return (
    <LocaleProvider locale="ar" messages={ar}>
      <Card variant="outline" padding="lg" style={{ width: "100%", maxWidth: "24rem" }}>
        <Card.Header
          title="الفاتورة الشهرية"
          description="مستحقة في 1 نوفمبر"
          action={
            <Badge tone="warning" variant="soft">
              قيد الانتظار
            </Badge>
          }
        />
        <Card.Footer justify="end">
          <Button variant="outline" tone="neutral">
            لاحقًا
          </Button>
          <Button>ادفع الآن</Button>
        </Card.Footer>
      </Card>
    </LocaleProvider>
  );
}

API reference

Card

Card props
PropTypeDefault
as

Element to render. article (default) for self-contained items, section for page regions, li inside a list of cards, div for no semantics.

"article""section""div""li"—
variant

Surface style.

"elevated""outline""filled""soft""elevated"
tone

Semantic color. Tints the soft variant (defaults to primary there) and colors the outline border. Has no effect on elevated or filled.

"neutral""primary""accent""success""warning""danger""info"—
radius

Corner rounding. pill is treated as --radius-2xl.

"none""xs""sm""md""lg""xl""2xl""pill""xl"
padding

Inner spacing (also sets the gap between parts).

"none""sm""md""lg""md"
orientation

vertical stacks parts top to bottom. horizontal puts Card.Media beside the content and collapses to vertical when the card is narrower than 30rem (container query on the card itself, so it works in grids). Horizontal cards size to their container, not their content.

"horizontal""vertical""vertical"
interactive

Hover lift (raise and stronger shadow). Use together with Card.LinkOverlay or Card.Title href so the whole card is clickable.

booleanfalse
selected

Shows the selected look: a primary ring plus a check badge (shape, not color alone). Purely visual: the selection semantics (e.g. a native radio or checkbox inside the card, or aria-selected on a listbox option) belong to the parent pattern.

booleanfalse
childrenReactNode—

Also accepts standard HTML attributes, plus className, style and ref.

Card.Header

Top row of a card: title and description on the start side, an optional action on the end side.

Card.Header props
PropTypeDefault
title

Title. A string or number is wrapped in Card.Title; pass your own <Card.Title> to change its level or add href.

ReactNode—
description

Supporting text under the title. A string or number is wrapped in Card.Description.

ReactNode—
action

Slot at the top-right (inline-end), e.g. an icon button or menu. Stays clickable above a stretched link.

ReactNode—
children

Extra content in the text column, after the title and description (e.g. tags or meta).

ReactNode—

Also accepts native <div> attributes, plus className, style and ref.

Card.Title

Card heading in the display font. Its color follows the card (so it stays contrast-verified on soft cards). The first title in a card also names an article card via aria-labelledby.

Card.Title props
PropTypeDefault
level

Heading level, chosen by document outline (not looks).

1234563
size

Visual size, independent of level.

"xs""sm""md""lg""xl""2xl""3xl""4xl""5xl""6xl""xl"
href

Makes the title a stretched link that covers the whole card (the card's single link, named by the title text). Shortcut for wrapping the text in Card.LinkOverlay.

string—

Also accepts native <h3> attributes, plus className, style and ref.

Card.Description

Muted supporting text (tone-tinted on soft cards).

Also accepts standard HTML attributes, plus className, style and ref.

Card.Body

Main content area. Grows to fill the card so footers line up across a grid.

Also accepts standard HTML attributes, plus className, style and ref.

Bottom row for actions. Buttons in it stay clickable above a stretched link.

Card.Footer props
PropTypeDefault
justify

Distribution of actions.

"start""center""end""between""stretch""end"

Also accepts native <div> attributes, plus className, style and ref.

Card.Media

Full-bleed media (image, video, illustration). Cancels the card's padding on its edges and follows the card's outer corner radius.

Card.Media props
PropTypeDefault
aspectRatio

Width-to-height ratio. Ignored beside the content in a horizontal card, where media fills the card's height.

"16/9""4/3""3/2""1/1""21/9""auto""16/9"
position

Which edge the media bleeds to. Defaults to start in horizontal cards and top otherwise.

"top""bottom""start"—
children

The image, video, or other media. Direct img, video, picture, iframe, and svg children are cropped to fill (object-fit: cover); any other single child is stretched to fill, and an Image fills and drops its own rounding without extra props. Give meaningful images real alt text; use alt="" for decorative ones.

ReactNode—

Also accepts native <div> attributes, plus className, style and ref.

Card.LinkOverlay

Accessible "stretched link". Renders one real link (or button/label) whose ::after covers the whole card, so the card is clickable while there is a single focus stop with a meaningful name. Other links and buttons inside the card are lifted above it and stay independently clickable. Use at most one per card, and don't place it inside Card.Media.

Card.LinkOverlay props
PropTypeDefault
as

a (default) for navigation, button for an in-page action (e.g. open a dialog), label to make the whole card toggle a form control inside it (point htmlFor at a radio or checkbox).

"a""button""label"—
children

Visible text; it becomes the accessible name, so make it meaningful (usually the title).

ReactNode—

Also accepts standard HTML attributes, plus className, style and ref.

See what changed in each version in the Changelog.

Accessibility report

Card targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Dark mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TabMoves to the card's link (Card.LinkOverlay) and its own buttons; the card itself isn't a tab stop.

Roles and states

Roles and states
ElementRoleStates and properties
Cardarticle (with as="article")aria-labelledby → Card.Title
Card.LinkOverlaylinkCovers the card for pointer clicks; one tab stop

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)