Card

Overview Style Guidelines Demos Code
  1. Style
  2. Theme
  3. Responsive design
  4. Spacing
  1. Style
  2. Theme
  3. Responsive design
  4. Spacing

Style

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

Theme

All card variants are available in light and dark theme.

Light theme

Card in light theme

Dark 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, rounded corners, and a thin border.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend elit sed est egestas, a sollicitudin mauris tincidunt.

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

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend elit sed est egestas, a sollicitudin mauris tincidunt.

Call to action
A light gray card with a light gray border can also be used as an alternate option.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend elit sed est egestas, a sollicitudin mauris tincidunt.

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

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eleifend elit sed est egestas, a sollicitudin mauris tincidunt.

Call to action
A dark gray card with a dark gray 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

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.

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.

Responsive design

Breakpoints

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

Large screens

Card layout on desktop

Small screens

Card layout on mobile

Spacing

Example Token Description
16 --rh-space-lg 16px spacer
24 --rh-space-xl 24px spacer
32 --rh-space-2xl 32px spacer
48 --rh-space-3xl 48px spacer

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.

Desktop

Card spacing on desktop

Mobile

Card spacing on mobile