2016-05-26 17:46:55 +08:00
|
|
|
---
|
|
|
|
category: Components
|
2022-11-09 12:28:04 +08:00
|
|
|
group: Data Display
|
2016-05-26 17:46:55 +08:00
|
|
|
title: Card
|
2020-06-05 13:50:09 +08:00
|
|
|
cover: https://gw.alipayobjects.com/zos/alicdn/keNB-R8Y9/Card.svg
|
2022-11-09 12:28:04 +08:00
|
|
|
demo:
|
|
|
|
cols: 2
|
2016-05-26 17:46:55 +08:00
|
|
|
---
|
|
|
|
|
2017-09-16 11:28:18 +08:00
|
|
|
Simple rectangular container.
|
2016-05-26 17:46:55 +08:00
|
|
|
|
2016-09-10 13:43:30 +08:00
|
|
|
## When To Use
|
2016-05-26 17:46:55 +08:00
|
|
|
|
2017-09-16 11:28:18 +08:00
|
|
|
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.
|
2016-05-26 17:46:55 +08:00
|
|
|
|
2022-11-09 12:28:04 +08:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
<code src="./demo/basic.tsx">Basic card</code>
|
|
|
|
<code src="./demo/border-less.tsx">No border</code>
|
|
|
|
<code src="./demo/simple.tsx">Simple card</code>
|
|
|
|
<code src="./demo/flexible-content.tsx">Customized content</code>
|
|
|
|
<code src="./demo/in-column.tsx">Card in column</code>
|
|
|
|
<code src="./demo/loading.tsx">Loading card</code>
|
|
|
|
<code src="./demo/grid-card.tsx">Grid card</code>
|
|
|
|
<code src="./demo/inner.tsx">Inner card</code>
|
|
|
|
<code src="./demo/tabs.tsx">With tabs</code>
|
|
|
|
<code src="./demo/meta.tsx">Support more content configuration</code>
|
|
|
|
|
2016-05-26 17:46:55 +08:00
|
|
|
## API
|
|
|
|
|
2019-12-26 14:37:39 +08:00
|
|
|
```jsx
|
2016-05-26 17:46:55 +08:00
|
|
|
<Card title="Card title">Card content</Card>
|
|
|
|
```
|
|
|
|
|
2017-07-07 13:36:54 +08:00
|
|
|
### Card
|
|
|
|
|
2019-07-11 14:14:33 +08:00
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
| --- | --- | --- | --- | --- |
|
2020-07-01 22:15:26 +08:00
|
|
|
| actions | The action list, shows at the bottom of the Card | Array<ReactNode> | - | |
|
2019-11-20 20:31:43 +08:00
|
|
|
| activeTabKey | Current TabPane's key | string | - | |
|
2020-04-28 14:09:54 +08:00
|
|
|
| bodyStyle | Inline style to apply to the card content | CSSProperties | - | |
|
2020-06-17 23:18:14 +08:00
|
|
|
| bordered | Toggles rendering of the border around the card | boolean | true | |
|
2019-07-11 14:14:33 +08:00
|
|
|
| cover | Card cover | ReactNode | - | |
|
2020-07-01 22:15:26 +08:00
|
|
|
| defaultActiveTabKey | Initial active TabPane's key, if `activeTabKey` is not set | string | - | |
|
2020-10-09 10:08:52 +08:00
|
|
|
| extra | Content to render in the top-right corner of the card | ReactNode | - | |
|
2020-10-21 10:33:43 +08:00
|
|
|
| headStyle | Inline style to apply to the card head | CSSProperties | - | |
|
2019-07-11 14:14:33 +08:00
|
|
|
| hoverable | Lift up when hovering card | boolean | false | |
|
|
|
|
| loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false | |
|
2019-11-20 20:31:43 +08:00
|
|
|
| size | Size of card | `default` \| `small` | `default` | |
|
2020-10-21 10:33:43 +08:00
|
|
|
| tabBarExtraContent | Extra content in tab bar | ReactNode | - | |
|
|
|
|
| tabList | List of TabPane's head | Array<{key: string, tab: ReactNode}> | - | |
|
|
|
|
| tabProps | [Tabs](/components/tabs/#Tabs) | - | - | |
|
2020-10-09 10:08:52 +08:00
|
|
|
| title | Card title | ReactNode | - | |
|
2019-07-11 14:14:33 +08:00
|
|
|
| type | Card style type, can be set to `inner` or not set | string | - | |
|
|
|
|
| onTabChange | Callback when tab is switched | (key) => void | - | |
|
2017-07-07 13:36:54 +08:00
|
|
|
|
|
|
|
### Card.Grid
|
|
|
|
|
2021-03-01 19:20:48 +08:00
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
| className | The className of container | string | - | |
|
|
|
|
| hoverable | Lift up when hovering card grid | boolean | true | |
|
|
|
|
| style | The style object of container | CSSProperties | - | |
|
2017-08-09 14:34:10 +08:00
|
|
|
|
|
|
|
### Card.Meta
|
|
|
|
|
2021-03-01 19:20:48 +08:00
|
|
|
| Property | Description | Type | Default | Version |
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
| avatar | Avatar or icon | ReactNode | - | |
|
|
|
|
| className | The className of container | string | - | |
|
|
|
|
| description | Description content | ReactNode | - | |
|
|
|
|
| style | The style object of container | CSSProperties | - | |
|
|
|
|
| title | Title content | ReactNode | - | |
|