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 examples
Default
A basic Card with an icon, heading, description, and metadata.
Card Heading
This is a description of the card providing supplemental information.
With image
Use Card.Image to render an edge-to-edge image in the card header instead of an icon.

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.
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.
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
| Name | Default | Description |
|---|---|---|
className | stringCSS class name(s) for custom styling. | |
padding | 'normal' | 'none' | 'condensed' | 'normal'Controls the internal padding of the Card. |
Card.Icon
| Name | Default | Description |
|---|---|---|
icon | React.ElementTypeAn Octicon or custom SVG icon to render. | |
aria-label | stringAccessible label for the icon. When omitted, the icon is treated as decorative. |
Card.Image
| Name | Default | Description |
|---|---|---|
src | stringThe image source URL. | |
alt | "" | stringAlt text for accessibility. Defaults to empty string (decorative). |
Card.Heading
| Name | Default | Description |
|---|---|---|
as | 'h3' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'The heading level to render. |