Card

Card is a styled container component with border, box-shadow, and border-radius that groups related content. It supports structured layouts with subcomponents or custom content.

Page navigation navigation

React
experimental

React examples

Default

A basic Card with an icon, heading, description, and metadata.

Card Heading

This is a description of the card providing supplemental information.

Updated 2 hours ago

With image

Use Card.Image to render an edge-to-edge image in the card header instead of an icon.

Octocat

Card with Image

This card uses an edge-to-edge image instead of an icon.

With metadata

Use Card.Metadata to display supplemental metadata content below the description.

primer/react

GitHub's design system implemented as React components for building consistent user interfaces.

1.2k stars

Padding

The padding prop controls the internal padding of the Card. Available values: normal (default), condensed, and none.

Normal padding

This card uses the default normal padding.

Condensed padding

This card uses condensed padding.

No padding

This card uses no padding.

Custom content

When no subcomponents (Card.Icon, Card.Heading, etc.) are used, Card renders as a plain styled container with your arbitrary children.

Custom Content Card

This card uses arbitrary custom content instead of the built-in subcomponents.

  • Item one
  • Item two
  • Item three

More code examples

See the Card Storybook stories

Props

Card

NameDefaultDescription
className
string

CSS class name(s) for custom styling.

padding
'normal'
'none' | 'condensed' | 'normal'

Controls the internal padding of the Card.

Card.Icon

NameDefaultDescription
icon
React.ElementType

An Octicon or custom SVG icon to render.

aria-label
string

Accessible label for the icon. When omitted, the icon is treated as decorative.

Card.Image

NameDefaultDescription
src
string

The image source URL.

alt
""
string

Alt text for accessibility. Defaults to empty string (decorative).

Card.Heading

NameDefaultDescription
as
'h3'
'h2' | 'h3' | 'h4' | 'h5' | 'h6'

The heading level to render.

Card.Description

No props documented

Card.Menu

No props documented

Card.Metadata

No props documented