Card
A container for related content in three forms: static, pressable or a link.
import { Card } from '@windmorph/react';Keyboard
| Key | Action | Where |
|---|---|---|
| Tab | Moves focus to a pressable or link card. A static card isn't focusable; Tab goes to its own buttons and links. | |
| Enter or Space | Activates a pressable card (onPress).Pressable card | Pressable card |
| Enter | Follows a link card (href). Space scrolls the page, as on any link.Link card | Link card |
Screen reader
- Role
- A static card is a plain
divwith no role. A pressable card is adivwithrole="button", because a<button>can't hold headings or media; a link card is alink(<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
secondaryoutline 2px outside the card, drawn as anoutlineso the card's own clipping never hides it. An outlined card's border also darkens toon-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-labelledbyoraria-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
hreffor a card that navigates andonPressfor one that runs an action. - Give images in a card an
alttext, oralt=""when the headline already says what they show.