Card

Cards are flexible surfaces used to group information in a small layout. They give small previews of information or provide secondary content in relation to the content it's near. Several cards can be used together to group related information.

A basic card

View a live version of this component and see how it can be customized.

View component via PatternFly Elements

Cards can be used in light and dark themes. They act as a blank canvas where elements and styles can be placed inside.

A breakdown of the parts of a card
Card in light theme
Card in dark theme

Color

Cards are secondary layouts that shouldn’t command too much attention and blend in with whatever background they’re placed on. The card container is the only required element and it consists of a background color and rounded corners. A thin border is required if the card background is the same color as the background it's placed on.

White card colors

A white card with a light gray border is the most common use case in the light theme

Gray card colors

A light gray card without a border can also be used as an alternate option

Black card colors

A black card with a dark gray border is the most common use case in the dark theme

Dark theme gray card colors

A dark gray card without a border can also be used as an alternate option

Layout

A card features header, body, and footer sections. Those sections should include a limited amount of content to ensure that the card doesn’t become too tall.

Example of a card layout
Anatomy of a card layout

Header

The header section is required, it introduces what the content is and shouldn’t be hidden.

Body

The body section can include a headline, text, an icon, or sometimes an image. The body section describes the content in more detail and shouldn’t be hidden.

Footer

The footer section can include normal links or a call to action. It can be hidden if necessary if there’s content included where a user can take an action.


Variants

There are several card variants that can be used for a variety of use cases.

Basic

Use to display basic content or long paragraphs of text. Secondary and Default calls to action may be used.

List

Use to display a short amount of content using various list styles. Secondary and Default calls to action may be used.

Data

Use to display quick facts or short data points under a label. A Secondary call to action may be used or not.

Logo

Use to display a customer logo in a variety of arrangements. A call to action is required, otherwise use a logo wall.

Bar

Use to add a small icon and a label group to the header section. A larger icon or a logo may be used.

Icon

Use to add an icon to the basic style above the text. Secondary and Default calls to action may be used.

Image

Use to add an image to the basic style above the text. Secondary and Default calls to action may be used.

Asset

Use to display that an asset can be downloaded. An icon and label group or text may be used to describe the asset.

Quote

Use to display a short quote with attribution text. Logos, images, and a Secondary call to action may be used or not.

Avatars

Use to highlight a group of people who engage in an event. A label should be included, but including text is optional.

Video

Use to trigger a video that will play in a Modal. Different layout configurations may be used.

Pricing

Use to outline the pricing and benefits of something. Elements may be removed or rearranged depending on content needs.

Logo slider

Use to display more content about a company when expanded on hover or tap. A title and text should be included.

Name slider

Use to display more content about a person when the tray expands. A title and text should be included.

Content

Cards have the potential to contain lots of content, like a combination of text, links, images, multimedia, etc. Ensure content serves the use case, but keep things simple at the same time. Don’t use too much content in one card, distribute extra content to other cards or somewhere else on the page. A Sticky card is a kind of card that can contain similar content, but it sticks to the side of a page and it’s always present until a user dismisses it.

Grouping

Different card styles can sometimes be grouped together. They can be arranged in a grid horizontally or vertically, depending on available space or screen size. Be sure to only group cards together that have similar styles or content. For example, grouping a basic card with a pricing card will look bad because they’re not very similar.

Grouping of a card

These cards can be grouped together because they have similar styles and content

Layout

Cards are small layouts that should be arranged on a grid and not float randomly in larger layouts. Cards have a minimum width of four columns and a maximum width of six columns.

Other components

Cards can include complex components if necessary. For example, the Filter component requires an Accordion or a Disclosure to sort a content set. Don't place any other complex components in card layouts.

Alternative card usage

The minimum width of a card in any layout is four columns and the maximum number of cards that can be used in a row is three.

Too many cards

Don’t use a primary call to action in any card unless the primary action of a page is positioned inside of that card.

Card width error

Don’t use multiple calls to action in one card. Instead, distribute them to other cards.

Multiple calls to action

Vertical height

The vertical height of cards depends on how much content is placed inside. If there are multiple cards in a row, the vertical height of each of them will be determined by the tallest card. Don’t place inconsistent amounts of content in cards, as this will impact how scannable the group will appear to users.

Card height behavior

Interactivity

If a card contains only one link destination, the entire container and any elements inside should all be interactive. Otherwise, each interactive element should continue to be interactive, but not the card container.

Card interaction

Breakpoints

Cards will get thinner or move below each other on smaller screens.

Large screens

Desktop cards

Small screens

Mobile cards

Since cards can consist of a variety of elements, refer to the specific interaction states that are assigned to each style and component for more information.


Cards use PatternFly 4 spacers to define spacing values between elements.

Container padding

Container padding defines how far away content is from the edges of the component. When cards become wider, the container padding increases. When they become thinner, the container padding decreases. See more examples here.

Desktop

Card spacing on desktop

Mobile

Card spacing on mobile

For feedback and bug reports concerning PatternFly Elements components, create an issue in the GitHub repository.