Design System

Card

A Card is usually a summary of a larger idea and acts as an entry point to more detailed information. This summary can contain text, images, buttons, and links.

An individual card is typically a member of a collection of similar cards, not a single card in isolation. A card can be distinguished from the broader page context with a border.

Cards are also modular, which means you can change the order of cards in a collection without affecting any individual card’s meaning.

Use a Card when you need to:

When to consider using a different component:

Properties

Border

A boolean prop that controls whether the card has a border. The default is true, which means the card will have a border. Setting it to false will remove the border.

Layout

The layout prop controls the layout of the card’s media and content. The default is vertical, which means the media is stacked vertically above the content. Setting it to horizontal will arrange the media either to the left or right of the content, based on the value of the Card Media subcomponent’s position prop.

Box Properties

The Card component inherits several properties from the parent Box component: as, color, and variant. Only the as property has special significance for the Card component.

As

A Card is rendered as an article by default but can be changed to another semantic element with the as prop. article is generally the preferred element for cards, as it represents a self-contained unit of content that could stand alone. But section is more generic and may be appropriate for certain use cases.

Subcomponents

The Card component has several subcomponents that can be used together to create a standardized card layout.

Card Media

This subcomponent is used to display an image or other media in the card.

Properties

Position

The position prop is only used with Cards that have a horizontal layout, and it controls on which side of the content the media is displayed. It can be set to either left or right. The default is left.

Card Body

This subcomponent is used to wrap the main content of the card, including the title, description, and footer. It ensures that the content is properly spaced and aligned within the card.

Card Title

This subcomponent is used to wrap the title of the card. It ensures that the title is properly formatted and spaced within the card. It should contain a heading element at the proper level (e.g., <h2>, <h3>) to maintain proper semantic structure and accessibility.

Card Description

This subcomponent is used to wrap the description or summary text of the card. It ensures that the description is properly formatted and spaced within the card. It should contain a paragraph element (e.g., <p>) to maintain proper semantic structure and accessibility.

This subcomponent is used to wrap the footer content of the card, such as buttons or links. It ensures that the footer content is properly spaced and aligned within the card.

Example

This basic React example shows how to use the Card component with its subcomponents to create a standard card layout.

An open book on a library table
Find your nearest library
See hours, events, and services at branches near you.

Usage notes

Accessibility

Storybooks