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.
With action
Use Card.Action to place a single interactive control in the top-right corner of the card. The control label should include card context.
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.
Semantic section
Set as="section" when the card should be exposed as a standalone landmark. When used this way, Card.Heading is automatically wired to the section with aria-labelledby.
primer/react
This card is rendered as a section landmark and uses its heading for accessible labeling.
In a list
When rendering a collection of cards, place each Card inside an <li> so the list provides grouping. See the accessibility guidance for details on semantics and labelling interactive controls.
primer/react
primer/css
primer/octicons
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
| Name | Default | Description |
|---|---|---|
children Required | React.ReactNodeThe contents of the card. Provide either | |
className | stringCSS class name(s) for custom styling. | |
padding | 'normal' | 'none' | 'condensed' | 'normal'Controls the internal padding of the Card. |
borderRadius | 'large' | 'medium' | 'large'Controls the border radius of the Card. |
as | 'div' | 'div' | 'section'The HTML element to render. Use |
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. When the parent Card uses |
Card.Description
| Name | Default | Description |
|---|---|---|
children Required | React.ReactNodeThe descriptive text for the card. Rendered inside a |
Card.Action
| Name | Default | Description |
|---|---|---|
children Required | React.ReactNodeInteractive control for the top-right corner of the card. |
Card.Metadata
| Name | Default | Description |
|---|---|---|
children Required | React.ReactNodeMetadata content for the bottom of the card. Accepts any content: plain text, icons, or other Primer components. |