Create

General

Card

Copy page View as Markdown Open in ChatGPT Open in Claude

Displays a card with header, content, and footer.

Usage#

app.component.ts
import { WdsCardComponent } from '@wds/angular/card';

Examples#

Default#

Sign Up
Email
Login Login with Google

Size#

size="sm" reduces the spacing and the title.

The small size fits dense views such as dashboards and lists.

Details

Image#

The media slot shows an image across the full width at the top, in a 16:9 ratio by default (--wds-card-media-ratio).

Mountain landscape New

Mountain hut stay, a local guide and transfers included.

Book now

Dividers#

header-divider and footer-divider add lines around the content.

Mark all as read View all

Slots#

The title and description slots replace the attributes, for example for formatted text.

Total Revenue $1,250.00 +12.5% Up from last month New Customers 1,234 −20% Acquisition needs attention

Content only#

A card without a header and a footer: empty sections leave no gaps.

API References#

wds-card#

Card: header (title, description, action), content and footer. Empty sections take no space.

Attributes

AttributeTypeDefaultDescription
headingstring''Card title. The title slot takes precedence.
descriptionstring''Description below the title. The description slot takes precedence.
heading-level.headingLevelnumber3Heading level for screen readers (aria-level).
sizeWdsCardSize'default'Size: sm reduces the spacing and the title.
header-divider.headerDividerbooleanfalseLine below the header.
footer-divider.footerDividerbooleanfalseLine above the footer.

Slots

SlotDescription
(default)Card content.
mediaAn image or other media at the top of the card, full width.
titleTitle (instead of heading).
descriptionDescription below the title (instead of description).
actionAction in the top right corner of the header (e.g. a button or a link).
footerFooter, usually buttons.

CSS parts (::part)

PartDescription
cardThe card container.
mediaThe media container.
headerThe header.
titleThe title.
descriptionThe description.
actionThe action container.
contentThe content.
footerThe footer.

CSS custom properties

PropertyDescription
--wds-card-paddingInner padding (default 24px, 16px in sm).
--wds-card-gapGap between sections.
--wds-card-radiusBorder radius.
--wds-card-backgroundBackground.
--wds-card-borderBorder color.
--wds-card-title-sizeTitle size.
--wds-card-media-ratioAspect ratio of the image in the media slot (default 16 / 9).

Accessibility#

Screen reader#

The title has role="heading" with aria-level from heading-level (default 3). Set the level that fits the outline of the page.

The card itself has no role: it is a visual group. When it stands for a separate part of the page, wrap it in <section> or <article> with an accessible name.

Give the image in the media slot an alt that describes it, or alt="" when it is decorative. An icon-only button in the action slot needs a label.

Keyboard support#

The card has no keyboard interaction of its own. Controls inside follow the page tab sequence.

Footer