Cards
Bootstrap’s cards provide a flexible and extensible content container with multiple variants and options.
Basic Example
Some quick example text to build on the card title and make up the bulk of the card's content.
<Card style={{ width: '18rem' }}> <Card.Img variant="top" src="holder.js/100px180" /> <Card.Body> <Card.Title>Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> </Card>;
Content types
Body
Use <Card.Body>
to pad content inside a <Card>
.
<Card> <Card.Body>This is some text within a card body.</Card.Body> </Card>;
Alernatively, you can use this shorthand version for Cards with body only, and no other children
<Card body>This is some text within a card body.</Card>;
Title, text, and links
Using <Card.Title>
, <Card.Subtitle>
, and
<Card.Text>
inside the <Card.Body>
will line them up nicely.
<Card.Link>
s are used to line up links next to each other.
Some quick example text to build on the card title and make up the bulk of the card's content.
Card LinkAnother Link<Card style={{ width: '18rem' }}> <Card.Body> <Card.Title>Card Title</Card.Title> <Card.Subtitle className="mb-2 text-muted">Card Subtitle</Card.Subtitle> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> <Card.Link href="#">Card Link</Card.Link> <Card.Link href="#">Another Link</Card.Link> </Card.Body> </Card>;
List Groups
Create lists of content in a card with a flush list group.
<Card style={{ width: '18rem' }}> <ListGroup variant="flush"> <ListGroup.Item>Cras justo odio</ListGroup.Item> <ListGroup.Item>Dapibus ac facilisis in</ListGroup.Item> <ListGroup.Item>Vestibulum at eros</ListGroup.Item> </ListGroup> </Card>;
<Card style={{ width: '18rem' }}> <Card.Header>Featured</Card.Header> <ListGroup variant="flush"> <ListGroup.Item>Cras justo odio</ListGroup.Item> <ListGroup.Item>Dapibus ac facilisis in</ListGroup.Item> <ListGroup.Item>Vestibulum at eros</ListGroup.Item> </ListGroup> </Card>;
Kitchen Sink
Some quick example text to build on the card title and make up the bulk of the card's content.
<Card style={{ width: '18rem' }}> <Card.Img variant="top" src="holder.js/100px180?text=Image cap" /> <Card.Body> <Card.Title>Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> <ListGroup className="list-group-flush"> <ListGroupItem>Cras justo odio</ListGroupItem> <ListGroupItem>Dapibus ac facilisis in</ListGroupItem> <ListGroupItem>Vestibulum at eros</ListGroupItem> </ListGroup> <Card.Body> <Card.Link href="#">Card Link</Card.Link> <Card.Link href="#">Another Link</Card.Link> </Card.Body> </Card>;
Header and Footer
You may add a header by adding a <Card.Header>
component.
With supporting text below as a natural lead-in to additional content.
<Card> <Card.Header>Featured</Card.Header> <Card.Body> <Card.Title>Special title treatment</Card.Title> <Card.Text> With supporting text below as a natural lead-in to additional content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> </Card>;
A <CardHeader>
can be styled by passing a heading element
through the <as>
prop
Featured
With supporting text below as a natural lead-in to additional content.
<Card> <Card.Header as="h5">Featured</Card.Header> <Card.Body> <Card.Title>Special title treatment</Card.Title> <Card.Text> With supporting text below as a natural lead-in to additional content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> </Card>;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<Card> <Card.Header>Quote</Card.Header> <Card.Body> <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> </Card.Body> </Card>;
With supporting text below as a natural lead-in to additional content.
<Card className="text-center"> <Card.Header>Featured</Card.Header> <Card.Body> <Card.Title>Special title treatment</Card.Title> <Card.Text> With supporting text below as a natural lead-in to additional content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> <Card.Footer className="text-muted">2 days ago</Card.Footer> </Card>;
Images
Cards include a few options for working with images. Choose from appending “image caps” at either end of a card, overlaying images with card content, or simply embedding 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.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
<> <Card> <Card.Img variant="top" src="holder.js/100px180" /> <Card.Body> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card> <Card.Body> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> <Card.Img variant="bottom" src="holder.js/100px180" /> </Card> </>;
Image Overlays
Turn an image into a card background and overlay your card’s text. Depending on the image, you may or may not need additional styles or utilities.
<Card className="bg-dark text-white"> <Card.Img src="holder.js/100px270" alt="Card image" /> <Card.ImgOverlay> <Card.Title>Card title</Card.Title> <Card.Text> 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.Text> <Card.Text>Last updated 3 mins ago</Card.Text> </Card.ImgOverlay> </Card>;
Navigation
Add some navigation to a card’s header (or block) with React Bootstrap’s Nav components.
With supporting text below as a natural lead-in to additional content.
<Card> <Card.Header> <Nav variant="tabs" defaultActiveKey="#first"> <Nav.Item> <Nav.Link href="#first">Active</Nav.Link> </Nav.Item> <Nav.Item> <Nav.Link href="#link">Link</Nav.Link> </Nav.Item> <Nav.Item> <Nav.Link href="#disabled" disabled> Disabled </Nav.Link> </Nav.Item> </Nav> </Card.Header> <Card.Body> <Card.Title>Special title treatment</Card.Title> <Card.Text> With supporting text below as a natural lead-in to additional content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> </Card>;
With supporting text below as a natural lead-in to additional content.
<Card> <Card.Header> <Nav variant="pills" defaultActiveKey="#first"> <Nav.Item> <Nav.Link href="#first">Active</Nav.Link> </Nav.Item> <Nav.Item> <Nav.Link href="#link">Link</Nav.Link> </Nav.Item> <Nav.Item> <Nav.Link href="#disabled" disabled> Disabled </Nav.Link> </Nav.Item> </Nav> </Card.Header> <Card.Body> <Card.Title>Special title treatment</Card.Title> <Card.Text> With supporting text below as a natural lead-in to additional content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> </Card>;
Card Styles
Background Color
You can change a card's appearance by changing their <bg>
, and <text>
props.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
<> <Card bg="primary" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Primary Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="secondary" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Secondary Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="success" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Success Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="danger" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Danger Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="warning" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Warning Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="info" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Info Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="dark" text="white" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Dark Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card bg="light" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Light Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> </>;
Border Color
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
<> <Card border="primary" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Primary Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="secondary" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Secondary Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="success" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Success Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="danger" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Danger Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="warning" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Warning Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="info" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Info Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="dark" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Dark Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> <Card border="light" style={{ width: '18rem' }}> <Card.Header>Header</Card.Header> <Card.Body> <Card.Title>Light Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> </Card.Body> </Card> <br /> </>;
Card layout
Card Groups
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This card has supporting text below as a natural lead-in to additional content.
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.
<CardGroup> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> 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.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> This card has supporting text below as a natural lead-in to additional content.{' '} </Card.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> 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.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> </CardGroup>;
Card Deck
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
This card has supporting text below as a natural lead-in to additional content.
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.
<CardDeck> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> 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.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> This card has supporting text below as a natural lead-in to additional content.{' '} </Card.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> 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.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> </CardDeck>;
Card Columns
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
This card has supporting text below as a natural lead-in to additional content.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
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
<CardColumns> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title that wraps to a new line</Card.Title> <Card.Text> This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. </Card.Text> </Card.Body> </Card> <Card className="p-3"> <blockquote className="blockquote mb-0 card-body"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. </p> <footer className="blockquote-footer"> <small className="text-muted"> Someone famous in <cite title="Source Title">Source Title</cite> </small> </footer> </blockquote> </Card> <Card> <Card.Img variant="top" src="holder.js/100px160" /> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> This card has supporting text below as a natural lead-in to additional content.{' '} </Card.Text> </Card.Body> <Card.Footer> <small className="text-muted">Last updated 3 mins ago</small> </Card.Footer> </Card> <Card bg="primary" text="white" className="text-center p-3"> <blockquote className="blockquote mb-0 card-body"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. </p> <footer className="blockquote-footer"> <small className="text-muted"> Someone famous in <cite title="Source Title">Source Title</cite> </small> </footer> </blockquote> </Card> <Card className="text-center"> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> This card has supporting text below as a natural lead-in to additional content.{' '} </Card.Text> <Card.Text> <small className="text-muted">Last updated 3 mins ago</small> </Card.Text> </Card.Body> </Card> <Card> <Card.Img src="holder.js/100px160" /> </Card> <Card className="text-right"> <blockquote className="blockquote mb-0 card-body"> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante. </p> <footer className="blockquote-footer"> <small className="text-muted"> Someone famous in <cite title="Source Title">Source Title</cite> </small> </footer> </blockquote> </Card> <Card> <Card.Body> <Card.Title>Card title</Card.Title> <Card.Text> 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.Text> <Card.Text> <small className="text-muted">Last updated 3 mins ago</small> </Card.Text> </Card.Body> </Card> </CardColumns>;
API
Cardview source file
import Card from 'react-bootstrap/Card'
Name | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bg | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | Sets card background | |
body | boolean | false | When this prop is set, it creates a Card with a Card.Body inside passing the children directly to it |
border | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | Sets card border color | |
text | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'white' | 'muted' | Sets card text color | |
bsPrefix required | string | 'card' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
Card.Bodyview source file
import Card from 'react-bootstrap/Card'
Name | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bsPrefix required | string | 'card-body' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
Card.Imgview source file
import Card from 'react-bootstrap/Card'
Name | Type | Default | Description |
---|---|---|---|
as | elementType | <img> | You can use a custom element type for this component. |
variant | 'top' | 'bottom' | null | Defines image position inside the card. |
bsPrefix required | string | 'card-img' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
Card.ImgOverlayview source file
import Card from 'react-bootstrap/Card'
Name | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bsPrefix required | string | 'card-img-overlay' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
CardDeckview source file
import CardDeck from 'react-bootstrap/CardDeck'
Name | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bsPrefix required | string | 'card-deck' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |
CardGroupview source file
import CardGroup from 'react-bootstrap/CardGroup'
Name | Type | Default | Description |
---|---|---|---|
as | elementType | <div> | You can use a custom element type for this component. |
bsPrefix required | string | 'card-group' | Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css. |