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
|
2022-11-30 20:14:41 +08:00
|
|
|
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*VXtCTp93KPAAAAAAAAAAAAAADrJ8AQ/original
|
2023-02-09 22:17:31 +08:00
|
|
|
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*a-8zR6rrupgAAAAAAAAAAAAADrJ8AQ/original
|
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
|
|
|
|
|
2022-11-17 17:31:26 +08:00
|
|
|
<!-- prettier-ignore -->
|
2022-11-09 12:28:04 +08:00
|
|
|
<code src="./demo/basic.tsx">Basic card</code>
|
2023-01-05 15:30:59 +08:00
|
|
|
<code src="./demo/border-less.tsx" background="grey">No border</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
<code src="./demo/simple.tsx">Simple card</code>
|
|
|
|
<code src="./demo/flexible-content.tsx">Customized content</code>
|
2023-01-05 15:30:59 +08:00
|
|
|
<code src="./demo/in-column.tsx" background="grey">Card in column</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
<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>
|
2023-06-01 15:16:58 +08:00
|
|
|
<code src="./demo/component-token.tsx" debug>Component Token</code>
|
2022-11-09 12:28:04 +08:00
|
|
|
|
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 | - | |
|
2023-05-16 22:24:41 +08:00
|
|
|
| tabList | List of TabPane's head | [TabItemType](/components/tabs#tabitemtype)[] | - | |
|
2022-12-22 14:12:26 +08:00
|
|
|
| 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
|
|
|
|
|
2022-11-17 17:31:26 +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
|
|
|
|
|
2022-11-17 17:31:26 +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 | - | |
|
2023-04-11 10:25:24 +08:00
|
|
|
|
|
|
|
## Design Token
|
|
|
|
|
|
|
|
<ComponentTokenTable component="Card"></ComponentTokenTable>
|