React Card Component

React card component provides a flexible and extensible container for displaying content. Card is delivered with a bunch of variants and options.

Other frameworks

CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.

About#

A react card component is a content container. It incorporates options for images, headers, and footers, a wide variety of content, contextual background colors, and excellent display options.

Example#

Cards are built with as little markup and styles as possible but still manage to deliver a bunch of control and customization. Built with flexbox, they offer easy alignment and mix well with other CoreUI components. Cards have no top, left, and right margins by default, so use spacing utilities as needed. They have no fixed width to start, so they'll fill the full width of its parent.

Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they'll naturally fill the full width of its parent element.

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
<CCard style={{ width: '18rem' }}>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's content.
</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>

Content types#

CoreUI card supports a wide variety of content, including images, text, list groups, links, and more. Below are examples of those elements.

Body#

The main block of a card is the <CCardBody>. Use it whenever you need a padded section within a card.

This is some text within a card body.
<CCard>
<CCardBody>This is some text within a card body.</CCardBody>
</CCard>

Card titles are managed by <CCardTitle> component. Identically, links are attached and collected next to each other by <CCardLink> component.

Subtitles are managed by <CCardSubtitle> component. If the <CCardTitle> also, the <CCardSubtitle> items are stored in a <CCardBody> item, the card title, and subtitle are arranged rightly.

Card title
Card subtitle

Some quick example text to build on the card title and make up the bulk of the card's content.

Card link Another link
<CCard style={{ width: '18rem' }}>
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardSubtitle className="mb-2 text-body-secondary">Card subtitle</CCardSubtitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's content.
</CCardText>
<CCardLink href="#">Card link</CCardLink>
<CCardLink href="#">Another link</CCardLink>
</CCardBody>
</CCard>

Images#

orientation="top" places a picture to the top of the card. With <CCardText>, text can be added to the card. Text within <CCardText> can additionally be styled with the regular HTML tags.

Some quick example text to build on the card title and make up the bulk of the card's content.

<CCard style={{ width: '18rem' }}>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's content.
</CCardText>
</CCardBody>
</CCard>

List groups#

Create lists of content in a card with a flush list group.

  • Cras justo odio
  • Dapibus ac facilisis in
  • Vestibulum at eros
<CCard style={{ width: '18rem' }}>
<CListGroup flush>
<CListGroupItem>Cras justo odio</CListGroupItem>
<CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
<CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
</CCard>
Header
  • Cras justo odio
  • Dapibus ac facilisis in
  • Vestibulum at eros
<CCard style={{ width: '18rem' }}>
<CCardHeader>Header</CCardHeader>
<CListGroup flush>
<CListGroupItem>Cras justo odio</CListGroupItem>
<CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
<CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
</CCard>
  • Cras justo odio
  • Dapibus ac facilisis in
  • Vestibulum at eros
<CCard style={{ width: '18rem' }}>
<CListGroup flush>
<CListGroupItem>Cras justo odio</CListGroupItem>
<CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
<CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
<CCardFooter>Footer</CCardFooter>
</CCard>

Kitchen sink#

Combine and match many content types to build the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

  • Cras justo odio
  • Dapibus ac facilisis in
  • Vestibulum at eros
<CCard style={{ width: '18rem' }}>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's content.
</CCardText>
</CCardBody>
<CListGroup flush>
<CListGroupItem>Cras justo odio</CListGroupItem>
<CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
<CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
<CCardBody>
<CCardLink href="#">Card link</CCardLink>
<CCardLink href="#">Another link</CCardLink>
</CCardBody>
</CCard>

Add an optional header and/or footer within a card.

Header
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard>
<CCardHeader>Header</CCardHeader>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>

Card headers can be styled by adding ex. as="h5".

Header
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard>
<CCardHeader as="h5">Header</CCardHeader>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
Quote

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

Someone famous in Source Title
<CCard>
<CCardHeader>Quote</CCardHeader>
<CCardBody>
<blockquote className="blockquote mb-0">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<footer className="blockquote-footer">
Someone famous in <cite title="Source Title">Source Title</cite>
</footer>
</blockquote>
</CCardBody>
</CCard>
Header
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard className="text-center">
<CCardHeader>Header</CCardHeader>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
<CCardFooter className="text-body-secondary">2 days ago</CCardFooter>
</CCard>

Sizing#

Cards assume no specific width to start, so they'll be 100% wide unless otherwise stated. You can adjust this as required with custom CSS, grid classes, grid Sass mixins, or services.

Using grid markup#

Using the grid, wrap cards in columns and rows as needed.

Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CRow>
<CCol sm={6}>
<CCard>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>
With supporting text below as a natural lead-in to additional content.
</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
</CCol>
<CCol sm={6}>
<CCard>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>
With supporting text below as a natural lead-in to additional content.
</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
</CCol>
</CRow>

Using utilities#

Use some of available sizing utilities to rapidly set a card's width.

Card title

With supporting text below as a natural lead-in to additional content.

Go somewhere
Card title

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard className="w-75">
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
<CCard className="w-50">
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>

Using custom CSS#

Use custom CSS in your stylesheets or as inline styles to set a width.

Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard style={{ width: '18rem' }}>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>

Text alignment#

You can instantly change the text arrangement of any card—in its whole or specific parts—with text align classes.

Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard style={{width: '18rem'}}>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
<CCard className="text-center" style={{width: '18rem'}}>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
<CCard className="text-end" style={{width: '18rem'}}>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>

Add some navigation to a <CCardHeader> with our <CNav> component.

Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard className="text-center">
<CCardHeader>
<CNav variant="tabs" className="card-header-tabs">
<CNavItem>
<CNavLink href="#" active>Active</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink href="#">Link</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink href="#" disabled>Disabled</CNavLink>
</CNavItem>
</CNav>
</CCardHeader>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere
<CCard className="text-center">
<CCardHeader>
<CNav variant="pills" className="card-header-pills">
<CNavItem>
<CNavLink href="#" active>Active</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink href="#">Link</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink href="#" disabled>Disabled</CNavLink>
</CNavItem>
</CNav>
</CCardHeader>
<CCardBody>
<CCardTitle>Special title treatment</CCardTitle>
<CCardText>With supporting text below as a natural lead-in to additional content.</CCardText>
<CButton color="primary" href="#">Go somewhere</CButton>
</CCardBody>
</CCard>

Images#

Cards introduce several options for acting with images. Pick from appending "image caps" at either end of a card, overlaying images with content, or just inserting the image in a card.

Image caps#

Similar to headers and footers, cards can include top and bottom "image caps"—images at the top or bottom of a card.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

<CCard className="mb-3">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CCardText>
<CCardText><small className="text-body-secondary">Last updated 3 mins ago</small></CCardText>
</CCardBody>
</CCard>
<CCard className="mb-3">
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CCardText>
<CCardText><small className="text-body-secondary">Last updated 3 mins ago</small></CCardText>
</CCardBody>
<CCardImage orientation="bottom" src={ReactImg} />
</CCard>

Image overlays#

Adapt an image into a background and overlay your text. Depending on the image, you may need additional styles or utilities.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

<CCard className="mb-3 bg-dark text-white">
<CCardImage src={ReactImg} />
<CCardImageOverlay>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional content.
This content is a little bit longer.
</CCardText>
<CCardText>Last updated 3 mins ago</CCardText>
</CCardImageOverlay>
</CCard>

Horizontal#

Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way. In the example below, we remove the grid gutters with .g-0 and use .col-md-* classes to make the card horizontal at the md breakpoint. Further adjustments may be needed depending on your card content.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

<CCard className="mb-3" style={{ maxWidth: '540px' }}>
<CRow className="g-0">
<CCol md={4}>
<CCardImage src={React400Img} />
</CCol>
<CCol md={8}>
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
<CCardText>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardText>
</CCardBody>
</CCol>
</CRow>
</CCard>

Card styles#

Cards include various options for customizing their backgrounds, borders, and color.

Background and color#

Use color property to change the appearance of a card.

Header
primary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
secondary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
success card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
danger card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
warning card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
info card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
light card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
dark card title

Some quick example text to build on the card title and make up the bulk of the card's content.

You can also apply contextual variations with the textBgColor property, which automatically sets the text color to ensure compliance with the WCAG 4.5:1 contrast ratio standard for enhanced accessibility.

<>
{[
{ color: 'primary' },
{ color: 'secondary' },
{ color: 'success' },
{ color: 'danger' },
{ color: 'warning' },
{ color: 'info' },
{ color: 'light' },
{ color: 'dark' },
].map((item, index) => (
<CCard
textBgColor={item.color}
className="mb-3"
style={{ maxWidth: '18rem' }}
key={index}
>
<CCardHeader>Header</CCardHeader>
<CCardBody>
<CCardTitle>{item.color} card title</CCardTitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's
content.
</CCardText>
</CCardBody>
</CCard>
))}
</>
Header
primary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
secondary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
success card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
danger card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
warning card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
info card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
light card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
dark card title

Some quick example text to build on the card title and make up the bulk of the card's content.

<>
{[
{ color: 'primary', textColor: 'white' },
{ color: 'secondary', textColor: 'white' },
{ color: 'success', textColor: 'white' },
{ color: 'danger', textColor: 'white' },
{ color: 'warning' },
{ color: 'info', textColor: 'white' },
{ color: 'light' },
{ color: 'dark', textColor: 'white' },
].map((item, index) => (
<CCard
color={item.color}
textColor={item.textColor}
className="mb-3"
style={{ maxWidth: '18rem' }}
key={index}
>
<CCardHeader>Header</CCardHeader>
<CCardBody>
<CCardTitle>{item.color} card title</CCardTitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's
content.
</CCardText>
</CCardBody>
</CCard>
))}
</>
Conveying meaning to assistive technologies

Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .visually-hidden class.

Border#

Use border utilities to change just the border-color of a card. Note that you can set textColor property on the <CCard> or a subset of the card's contents as shown below.

Header
primary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
secondary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
success card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
danger card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
warning card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
info card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
light card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
dark card title

Some quick example text to build on the card title and make up the bulk of the card's content.

<>
{[
{ color: 'primary', textColor: 'primary' },
{ color: 'secondary', textColor: 'secondary' },
{ color: 'success', textColor: 'success' },
{ color: 'danger', textColor: 'danger' },
{ color: 'warning', textColor: 'warning' },
{ color: 'info', textColor: 'info' },
{ color: 'light' },
{ color: 'dark' },
].map((item, index) => (
<CCard
textColor={item.textColor}
className={`mb-3 border-${item.color}`}
style={{ maxWidth: '18rem' }}
key={index}
>
<CCardHeader>Header</CCardHeader>
<CCardBody>
<CCardTitle>{item.color} card title</CCardTitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's
content.
</CCardText>
</CCardBody>
</CCard>
))}
</>

Top border#

Header
primary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
secondary card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
success card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
danger card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
warning card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
info card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
light card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header
dark card title

Some quick example text to build on the card title and make up the bulk of the card's content.

<>
{[
{ color: 'primary', textColor: 'primary' },
{ color: 'secondary', textColor: 'secondary' },
{ color: 'success', textColor: 'success' },
{ color: 'danger', textColor: 'danger' },
{ color: 'warning', textColor: 'warning' },
{ color: 'info', textColor: 'info' },
{ color: 'light' },
{ color: 'dark' },
].map((item, index) => (
<CCard
textColor={item.textColor}
className={`mb-3 border-top-${item.color} border-top-3`}
style={{ maxWidth: '18rem' }}
key={index}
>
<CCardHeader>Header</CCardHeader>
<CCardBody>
<CCardTitle>{item.color} card title</CCardTitle>
<CCardText>
Some quick example text to build on the card title and make up the bulk of the card's
content.
</CCardText>
</CCardBody>
</CCard>
))}
</>

Card layout#

In addition to styling the content within cards, CoreUI includes a few options for laying out series of cards. For the time being, these layout options are not yet responsive.

Card groups#

Use card groups to render cards as a single, attached element with equal width and height columns. Card groups start off stacked and use display: flex; to become attached with uniform dimensions starting at the sm breakpoint.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

Card title

This card has supporting text below as a natural lead-in to additional content.

Last updated 3 mins ago

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

Last updated 3 mins ago

<CCardGroup>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional content.
This content is a little bit longer.
</CCardText>
<CCardText>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardText>
</CCardBody>
</CCard>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This card has supporting text below as a natural lead-in to additional content.
</CCardText>
<CCardText>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardText>
</CCardBody>
</CCard>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional content.
This card has even longer content than the first to show that equal height action.
</CCardText>
<CCardText>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardText>
</CCardBody>
</CCard>
</CCardGroup>

When using card groups with footers, their content will automatically line up.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This card has supporting text below as a natural lead-in to additional content.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

<CCardGroup>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional content.
This content is a little bit longer.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This card has supporting text below as a natural lead-in to additional content.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional content.
This card has even longer content than the first to show that equal height action.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCardGroup>

Grid cards#

Use the CRow component and set xs|sm|md|lg|xl|xxl}={{ cols: * }} property to control how many grid columns (wrapped around your cards) you show per row. For example, here's xs={{cols: 1}} laying out the cards on one column, and md={{cols: 1}} splitting four cards to equal width across multiple rows, from the medium breakpoint up.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

<CRow xs={{ cols: 1, gutter: 4 }} md={{ cols: 2 }}>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
</CRow>

Change it to md={{ cols: 3}} and you'll see the fourth card wrap.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

<CRow xs={{ cols: 1, gutter: 4 }} md={{ cols: 3 }}>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard>
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
</CRow>

When you need equal height, add .h-100 to the cards. If you want equal heights by default, you can set $card-height: 100% in Sass.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This card has supporting text below as a natural lead-in to additional content.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

<CRow xs={{ cols: 1 }} md={{ cols: 3 }} className="g-4">
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
</CCard>
</CCol>
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This card has supporting text below as a natural lead-in to additional content.
</CCardText>
</CCardBody>
</CCard>
</CCol>
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This card has even longer content than the first to show that equal height
action.
</CCardText>
</CCardBody>
</CCard>
</CCol>
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
</CCard>
</CCol>
</CRow>

Just like with card groups, card footers will automatically line up.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Card title

This card has supporting text below as a natural lead-in to additional content.

Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

<CRow xs={{ cols: 1 }} md={{ cols: 3 }} className="g-4">
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This content is a little bit longer.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This card has supporting text below as a natural lead-in to additional content.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
<CCol xs>
<CCard className="h-100">
<CCardImage orientation="top" src={ReactImg} />
<CCardBody>
<CCardTitle>Card title</CCardTitle>
<CCardText>
This is a wider card with supporting text below as a natural lead-in to additional
content. This card has even longer content than the first to show that equal height
action.
</CCardText>
</CCardBody>
<CCardFooter>
<small className="text-body-secondary">Last updated 3 mins ago</small>
</CCardFooter>
</CCard>
</CCol>
</CRow>

Customizing#

CSS variables#

React cards use local CSS variables on .card for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

--cui-card-spacer-y: #{$card-spacer-y};
--cui-card-spacer-x: #{$card-spacer-x};
--cui-card-title-spacer-y: #{$card-title-spacer-y};
--cui-card-title-color: #{$card-title-color};
--cui-card-subtitle-color: #{$card-subtitle-color};
--cui-card-border-width: #{$card-border-width};
--cui-card-border-color: #{$card-border-color};
--cui-card-border-radius: #{$card-border-radius};
--cui-card-box-shadow: #{$card-box-shadow};
--cui-card-inner-border-radius: #{$card-inner-border-radius};
--cui-card-cap-padding-y: #{$card-cap-padding-y};
--cui-card-cap-padding-x: #{$card-cap-padding-x};
--cui-card-cap-bg: #{$card-cap-bg};
--cui-card-cap-color: #{$card-cap-color};
--cui-card-height: #{$card-height};
--cui-card-color: #{$card-color};
--cui-card-bg: #{$card-bg};
--cui-card-img-overlay-padding: #{$card-img-overlay-padding};
--cui-card-group-margin: #{$card-group-margin};

How to use CSS variables#

const vars = {
'--my-css-var': 10,
'--my-another-css-var': "red"
}
return <CCard style={vars}>...</CCard>

SASS variables#

$card-spacer-y: $spacer !default;
$card-spacer-x: $spacer !default;
$card-title-spacer-y: $spacer * .5 !default;
$card-title-color: null !default;
$card-subtitle-color: null !default;
$card-border-width: var(--cui-border-width) !default;
$card-border-color: var(--cui-border-color-translucent) !default;
$card-border-radius: var(--cui-border-radius) !default;
$card-box-shadow: null !default;
$card-inner-border-radius: subtract($card-border-radius, $card-border-width) !default;
$card-cap-padding-y: $card-spacer-y * .5 !default;
$card-cap-padding-x: $card-spacer-x !default;
$card-cap-bg: rgba(var(--cui-body-color-rgb), .03) !default;
$card-cap-color: null !default;
$card-height: null !default;
$card-color: null !default;
$card-bg: var(--cui-body-bg) !default;
$card-img-overlay-padding: $spacer !default;
$card-group-margin: $grid-gutter-width * .5 !default;

API#

CCard#

import { CCard } from '@coreui/react'
// or
import CCard from '@coreui/react/src/components/card/CCard'
PropertyDescriptionTypeDefault
classNameA string of all className you want applied to the base component.string-
colorSets the color context of the component to one of CoreUI’s themed colors.{'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'primary-gradient' | 'secondary-gradient' | 'success-gradient' | 'danger-gradient' | 'warning-gradient' | 'info-gradient' | 'dark-gradient' | 'light-gradient' | string }-
textBgColor
5.0.0+
Sets the component's color scheme to one of CoreUI's themed colors, ensuring the text color contrast adheres to the WCAG 4.5:1 contrast ratio standard for accessibility.'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string-
textColorSets the text color context of the component to one of CoreUI’s themed colors.'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'primary-emphasis' | 'secondary-emphasis' | 'success-emphasis' | 'danger-emphasis' | 'warning-emphasis' | 'info-emphasis' | 'light-emphasis' | 'body' | 'body-emphasis' | 'body-secondary' | 'body-tertiary' | 'black' | 'black-50' | 'white' | 'white-50' | string-

CCardBody#

import { CCardBody } from '@coreui/react'
// or
import CCardBody from '@coreui/react/src/components/card/CCardBody'
PropertyDescriptionTypeDefault
classNameA string of all className you want applied to the base component.string-

CCardFooter#

import { CCardFooter } from '@coreui/react'
// or
import CCardFooter from '@coreui/react/src/components/card/CCardFooter'
PropertyDescriptionTypeDefault
classNameA string of all className you want applied to the base component.string-

CCardGroup#

import { CCardGroup } from '@coreui/react'
// or
import CCardGroup from '@coreui/react/src/components/card/CCardGroup'
PropertyDescriptionTypeDefault
classNameA string of all className you want applied to the base component.string-

CCardHeader#

import { CCardHeader } from '@coreui/react'
// or
import CCardHeader from '@coreui/react/src/components/card/CCardHeader'
PropertyDescriptionTypeDefault
asComponent used for the root node. Either a string to use a HTML element or a component.(ElementType & 'symbol') | (ElementType & 'object') | (ElementType & 'div') | (ElementType & 'slot') | (ElementType & 'style') | ... 173 more ... | (ElementType & FunctionComponent<...>)-
classNameA string of all className you want applied to the base component.string-

CCardImage#

import { CCardImage } from '@coreui/react'
// or
import CCardImage from '@coreui/react/src/components/card/CCardImage'
PropertyDescriptionTypeDefault
asComponent used for the root node. Either a string to use a HTML element or a component.(ElementType & 'symbol') | (ElementType & 'object') | (ElementType & 'img') | (ElementType & 'slot') | (ElementType & 'style') | ... 173 more ... | (ElementType & FunctionComponent<...>)-
classNameA string of all className you want applied to the base component.string-
orientationOptionally orientate the image to the top, bottom, or make it overlaid across the card.'top' | 'bottom'-

CCardImageOverlay#

import { CCardImageOverlay } from '@coreui/react'
// or
import CCardImageOverlay from '@coreui/react/src/components/card/CCardImageOverlay'
PropertyDescriptionTypeDefault
classNameA string of all className you want applied to the base component.string-
import { CCardLink } from '@coreui/react'
// or
import CCardLink from '@coreui/react/src/components/card/CCardLink'
PropertyDescriptionTypeDefault
classNameA string of all className you want applied to the base component.string-
hrefThe href attribute specifies the URL of the page the link goes to.string-

CCardSubtitle#

import { CCardSubtitle } from '@coreui/react'
// or
import CCardSubtitle from '@coreui/react/src/components/card/CCardSubtitle'
PropertyDescriptionTypeDefault
asComponent used for the root node. Either a string to use a HTML element or a component.(ElementType & 'symbol') | (ElementType & 'object') | (ElementType & 'h6') | (ElementType & 'slot') | (ElementType & 'style') | ... 173 more ... | (ElementType & FunctionComponent<...>)-
classNameA string of all className you want applied to the component.string-

CCardText#

import { CCardText } from '@coreui/react'
// or
import CCardText from '@coreui/react/src/components/card/CCardText'
PropertyDescriptionTypeDefault
asComponent used for the root node. Either a string to use a HTML element or a component.(ElementType & 'symbol') | (ElementType & 'object') | (ElementType & 'p') | (ElementType & 'slot') | (ElementType & 'style') | ... 173 more ... | (ElementType & FunctionComponent<...>)-
classNameA string of all className you want applied to the component.string-

CCardTitle#

import { CCardTitle } from '@coreui/react'
// or
import CCardTitle from '@coreui/react/src/components/card/CCardTitle'
PropertyDescriptionTypeDefault
asComponent used for the root node. Either a string to use a HTML element or a component.(ElementType & 'symbol') | (ElementType & 'object') | (ElementType & 'h5') | (ElementType & 'slot') | (ElementType & 'style') | ... 173 more ... | (ElementType & FunctionComponent<...>)-
classNameA string of all className you want applied to the component.string-