Skip to content

Card

A container for related content in three forms: static, pressable or a link.

import { Card } from '@windmorph/react';

Keyboard

Card keyboard
KeyAction
TabMoves focus to a pressable or link card. A static card isn't focusable; Tab goes to its own buttons and links.
Enter or SpaceActivates a pressable card (onPress).Pressable card
EnterFollows a link card (href). Space scrolls the page, as on any link.Link card

Screen reader

Role
A static card is a plain div with no role. A pressable card is a div with role="button", because a <button> can't hold headings or media; a link card is a link (<a>).
Accessible name
A pressable or link card is named by all of its visible text, in reading order, as a link wrapping it would be, so the name holds everything the card shows (WCAG 2.5.3). Images with alt="" add nothing.
States announced
Disabled (aria-disabled) on a pressable card.

A static card's content is read in order, like any other content.

Focus

  • A pressable or link card is one Tab stop where it sits in the page. A disabled card can't be focused.
  • Keyboard focus shows M3's focus indicator: a 3px secondary outline 2px outside the card, drawn as an outline so the card's own clipping never hides it. An outlined card's border also darkens to on-surface. Pointer presses show no ring.

Touch target

An interactive card is as large as its content and fills its container's width, so it is well over 48 × 48px in practice. It has no TouchTarget; keep a pressable card at least 48px tall.

Motion

Under reduced motion the press ripple of an interactive card appears at full size without growing. Colours and elevation still fade.

What you need to do

  • Put a pressable or link card's headline first and keep its text short: the card is announced by all of it. Don't name it by its headline alone with aria-labelledby or aria-label, which leaves its other visible text out of the name (WCAG 2.5.3). When a card holds more than a short name should, make it a static card with its own link or button.
  • Don't put buttons, links or fields inside a pressable or link card: interactive content can't nest. In development the card warns when it finds any. Use a static card with its own actions instead.
  • Use href for a card that navigates and onPress for one that runs an action.
  • Give images in a card an alt text, or alt="" when the headline already says what they show.