Descriptions
Display multiple read-only fields in groups.
When To Use#
Commonly displayed on the details page.
Examples
User Info
UserNameZhou Maomao | Telephone1810000000 | LiveHangzhou, Zhejiang |
Remarkempty | AddressNo. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China |
import { Descriptions } from 'antd';
ReactDOM.render(
<Descriptions title="User Info">
<Descriptions.Item label="UserName">Zhou Maomao</Descriptions.Item>
<Descriptions.Item label="Telephone">1810000000</Descriptions.Item>
<Descriptions.Item label="Live">Hangzhou, Zhejiang</Descriptions.Item>
<Descriptions.Item label="Remark">empty</Descriptions.Item>
<Descriptions.Item label="Address">
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</Descriptions.Item>
</Descriptions>,
mountNode,
);
User Info
Product | Cloud Database | Billing Mode | Prepaid | Automatic Renewal | YES |
---|---|---|---|---|---|
Order time | 2018-04-24 18:00:00 | Usage Time | 2019-04-24 18:00:00 | ||
Status | Running | ||||
Negotiated Amount | $80.00 | Discount | $20.00 | Official Receipts | $60.00 |
Config Info | Data disk type: MongoDB Database version: 3.4 Package: dds.mongo.mid Storage space: 10 GB Replication factor: 3 Region: East China 1 |
import { Descriptions, Badge } from 'antd';
ReactDOM.render(
<Descriptions title="User Info" bordered>
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
<Descriptions.Item label="Billing Mode">Prepaid</Descriptions.Item>
<Descriptions.Item label="Automatic Renewal">YES</Descriptions.Item>
<Descriptions.Item label="Order time">2018-04-24 18:00:00</Descriptions.Item>
<Descriptions.Item label="Usage Time" span={2}>
2019-04-24 18:00:00
</Descriptions.Item>
<Descriptions.Item label="Status" span={3}>
<Badge status="processing" text="Running" />
</Descriptions.Item>
<Descriptions.Item label="Negotiated Amount">$80.00</Descriptions.Item>
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
<Descriptions.Item label="Official Receipts">$60.00</Descriptions.Item>
<Descriptions.Item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
</Descriptions>,
mountNode,
);
Custom Size
Product | Cloud Database | Billing | Prepaid | time | 18:00:00 |
---|---|---|---|---|---|
Amount | $80.00 | Discount | $20.00 | Official | $60.00 |
Config Info | Data disk type: MongoDB Database version: 3.4 Package: dds.mongo.mid Storage space: 10 GB Replication factor: 3 Region: East China 1 |
Custom Size
ProductCloud Database | BillingPrepaid | time18:00:00 |
Amount$80.00 | Discount$20.00 | Official$60.00 |
import { Descriptions, Radio, Button } from 'antd';
class Demo extends React.Component {
state = {
size: 'default',
};
onChange = e => {
console.log('size checked', e.target.value);
this.setState({
size: e.target.value,
});
};
render() {
return (
<div>
<Radio.Group onChange={this.onChange} value={this.state.size}>
<Radio value="default">default</Radio>
<Radio value="middle">middle</Radio>
<Radio value="small">small</Radio>
</Radio.Group>
<br />
<br />
<Descriptions
bordered
title="Custom Size"
size={this.state.size}
extra={<Button type="primary">Edit</Button>}
>
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
<Descriptions.Item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
</Descriptions>
<br />
<br />
<Descriptions
title="Custom Size"
size={this.state.size}
extra={<Button type="primary">Edit</Button>}
>
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
</Descriptions>
</div>
);
}
}
ReactDOM.render(<Demo />, mountNode);
Responsive Descriptions
Product | Cloud Database | Billing | Prepaid | time | 18:00:00 |
---|---|---|---|---|---|
Amount | $80.00 | Discount | $20.00 | Official | $60.00 |
Config Info | Data disk type: MongoDB Database version: 3.4 Package: dds.mongo.mid Storage space: 10 GB Replication factor: 3 Region: East China 1 |
import { Descriptions } from 'antd';
const Demo = () => (
<div>
<Descriptions
title="Responsive Descriptions"
bordered
column={{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }}
>
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
<Descriptions.Item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1
</Descriptions.Item>
</Descriptions>
</div>
);
ReactDOM.render(<Demo />, mountNode);
User Info
UserName | Telephone | Live |
---|---|---|
Zhou Maomao | 1810000000 | Hangzhou, Zhejiang |
Address | Remark | |
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China | empty |
import { Descriptions } from 'antd';
ReactDOM.render(
<Descriptions title="User Info" layout="vertical">
<Descriptions.Item label="UserName">Zhou Maomao</Descriptions.Item>
<Descriptions.Item label="Telephone">1810000000</Descriptions.Item>
<Descriptions.Item label="Live">Hangzhou, Zhejiang</Descriptions.Item>
<Descriptions.Item label="Address" span={2}>
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</Descriptions.Item>
<Descriptions.Item label="Remark">empty</Descriptions.Item>
</Descriptions>,
mountNode,
);
User Info
Product | Billing Mode | Automatic Renewal |
---|---|---|
Cloud Database | Prepaid | YES |
Order time | Usage Time | |
2018-04-24 18:00:00 | 2019-04-24 18:00:00 | |
Status | ||
Running | ||
Negotiated Amount | Discount | Official Receipts |
$80.00 | $20.00 | $60.00 |
Config Info | ||
Data disk type: MongoDB Database version: 3.4 Package: dds.mongo.mid Storage space: 10 GB Replication factor: 3 Region: East China 1 |
import { Descriptions, Badge } from 'antd';
ReactDOM.render(
<Descriptions title="User Info" layout="vertical" bordered>
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
<Descriptions.Item label="Billing Mode">Prepaid</Descriptions.Item>
<Descriptions.Item label="Automatic Renewal">YES</Descriptions.Item>
<Descriptions.Item label="Order time">2018-04-24 18:00:00</Descriptions.Item>
<Descriptions.Item label="Usage Time" span={2}>
2019-04-24 18:00:00
</Descriptions.Item>
<Descriptions.Item label="Status" span={3}>
<Badge status="processing" text="Running" />
</Descriptions.Item>
<Descriptions.Item label="Negotiated Amount">$80.00</Descriptions.Item>
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
<Descriptions.Item label="Official Receipts">$60.00</Descriptions.Item>
<Descriptions.Item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</Descriptions.Item>
</Descriptions>,
mountNode,
);
API#
Descriptions#
Property | Description | Type | Default | Version |
---|---|---|---|---|
bordered | Whether to display the border | boolean | false | |
colon | Change default props colon value of Descriptions.Item | boolean | true | |
column | The number of DescriptionItems in a row,could be a number or a object like { xs: 8, sm: 16, md: 24} ,(Only set bordered={true} to take effect) | number | 3 | |
contentStyle | Customize content style | CSSProperties | - | 4.10.0 |
extra | The action area of the description list, placed at the top-right | ReactNode | - | 4.5.0 |
labelStyle | Customize label style | CSSProperties | - | 4.10.0 |
layout | Define description layout | horizontal | vertical | horizontal | |
size | Set the size of the list. Can be set to middle ,small , or not filled | default | middle | small | - | |
title | The title of the description list, placed at the top | ReactNode | - |
DescriptionItem#
Property | Description | Type | Default | Version |
---|---|---|---|---|
contentStyle | Customize content style | CSSProperties | - | 4.9.0 |
label | The description of the content | ReactNode | - | |
labelStyle | Customize label style | CSSProperties | - | 4.9.0 |
span | The number of columns included | number | 1 |
The number of span Description.Item. Span={2} takes up the width of two DescriptionItems. When both
style
andlabelStyle
(orcontentStyle
) configured, both of them will work. And next one will overwrite first when conflict.