Card

Simple rectangular container.

When To Use#

A card can be used to display content related to a single subject. The content can consist of multiple elements of varying types and sizes.

Examples

Card title

Card content

Card content

Card content

A basic card containing a title, content and an extra corner content.

expand codeexpand code
import { Card } from 'antd';

ReactDOM.render(
  <Card title="Card title" extra={<a href="#">More</a>} style={{ width: 300 }}>
    <p>Card content</p>
    <p>Card content</p>
    <p>Card content</p>
  </Card>
, mountNode);
Card title

Card content

Card content

Card content

A borderless card on a gray background.

expand codeexpand code
import { Card } from 'antd';

ReactDOM.render(
  <div style={{ background: '#ECECEC', padding: '30px' }}>
    <Card title="Card title" bordered={false} style={{ width: 300 }}>
      <p>Card content</p>
      <p>Card content</p>
      <p>Card content</p>
    </Card>
  </div>
, mountNode);

Card content

Card content

Card content

A simple card only containing a content area.

expand codeexpand code
import { Card } from 'antd';

ReactDOM.render(
  <Card style={{ width: 300 }}>
    <p>Card content</p>
    <p>Card content</p>
    <p>Card content</p>
  </Card>
, mountNode);
example

Europe Street beat

www.instagram.com

Customizing default width and margin.

expand codeexpand code
import { Card } from 'antd';

ReactDOM.render(
  <Card style={{ width: 240 }} bodyStyle={{ padding: 0 }}>
    <div className="custom-image">
      <img alt="example" width="100%" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" />
    </div>
    <div className="custom-card">
      <h3>Europe Street beat</h3>
      <p>www.instagram.com</p>
    </div>
  </Card>
, mountNode);
.custom-image img {
  display: block;
}
.custom-card {
  padding: 10px 16px;
}
.custom-card p {
  color: #999;
}
Card title
Card content
Card title
Card content
Card title
Card content

Cards usually cooperate with grid column layout in overview page.

expand codeexpand code
import { Card, Col, Row } from 'antd';

ReactDOM.render(
  <div style={{ background: '#ECECEC', padding: '30px' }}>
    <Row gutter={16}>
      <Col span={8}>
        <Card title="Card title" bordered={false}>Card content</Card>
      </Col>
      <Col span={8}>
        <Card title="Card title" bordered={false}>Card content</Card>
      </Col>
      <Col span={8}>
        <Card title="Card title" bordered={false}>Card content</Card>
      </Col>
    </Row>
  </div>
, mountNode);
Card title

Shows a loading indicator while the contents of the card is being fetched.

expand codeexpand code
import { Card } from 'antd';

ReactDOM.render(
  <Card loading title="Card title" style={{ width: '34%' }}>
    Whatever content
  </Card>
, mountNode);
Card Title
Content
Content
Content
Content
Content
Content
Content

Grid style card content.

expand codeexpand code
import { Card } from 'antd';

const gridStyle = {
  width: '25%',
  textAlign: 'center',
};

ReactDOM.render(
  <Card title="Card Title" noHovering>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
    <Card.Grid style={gridStyle}>Content</Card.Grid>
  </Card>
, mountNode);

API#

<Card title="Card title">Card content</Card>

Card#

PropertyDescriptionTypeDefault
bodyStyleInline style to apply to the card contentobject-
borderedToggles rendering of the border around the cardbooleantrue
extraContent to render in the top-right corner of the cardstring|ReactNode-
loadingShows a loading indicator while the contents of the card are being fetchedbooleanfalse
noHoveringWhether to disable hover effect on mouse overbooleanfalse
titleCard titlestring|ReactNode-

Card.Grid#

PropertyDescriptionTypeDefault
classNameclassName of containerstring-
stylestyle object of containerobject-