--- localeCode: en-US order: 47 category: Show title: Card subTitle: Card icon: doc-card brief: Card container can consist of titles, paragraphs, pictures, lists, and other content. --- ## Demos ### How to import ```jsx import import { Card } from '@douyinfe/semi-ui'; ``` ### Basic card The basic card contains the title, content and other parts. ```jsx live=true dir="column" import React from 'react'; import { Card, Typography } from '@douyinfe/semi-ui'; function Demo() { const { Text } = Typography; return ( More } > Semi Design is a design system developed and maintained by IES-FE & IES-UED. The design system includes a design language and a set of reusable front-end components, helping designers and developers to more easily create high-quality, consistent user experience, design-compliant Web applications. ); } ``` ### Simple card The card can only set the content area. ```jsx live=true dir="column" import React from 'react'; import { Card, Popover, Avatar } from '@douyinfe/semi-ui'; import { IconInfoCircle } from '@douyinfe/semi-icons'; function Demo() { const { Meta } = Card; return ( <> Semi Design is a design system developed and maintained by IES-FE & IES-UED.
} /> This is a card. } > ); } ``` ### Cover You can use the `cover` property to set the cover. ```jsx live=true dir="column" import React from 'react'; import { Card } from '@douyinfe/semi-ui'; function Demo() { const { Meta } = Card; return ( } > ); } ``` ### Border and line You can use `bordered` to set whether the card has an outer border, the default is true. At the same time, you can also use `headerLine` to set whether the content area and title area have borders, and `footerLine` to set whether the content area and footer area have borders. ```jsx live=true dir="column" import React from 'react'; import { Card } from '@douyinfe/semi-ui'; function Demo() { return (
Semi Design is a design system developed and maintained by IES-FE & IES-UED. The design system includes a design language and a set of reusable front-end components, helping designers and developers to more easily create high-quality, consistent user experience, design-compliant Web applications.
); } ``` ### Shadows You can use `shadows` to set the timing of the shadow display. Optional: `hover` (show shadow when hover), `always` (show shadow always), if this property is not set, there will be no shadow. ```jsx live=true dir="column" import React from 'react'; import { Card, Avatar, Popover } from '@douyinfe/semi-ui'; import { IconInfoCircle } from '@douyinfe/semi-icons'; function Demo() { const { Meta } = Card; return (
} /> This is a card. } >
} /> This is a card. } >
); } ``` ### Customized content You can use `Card.Meta` to support more flexible content, allowing you to set `title`, `avatar`, and `description`. ```jsx live=true dir="column" import React from 'react'; import { Card, Avatar, Space, Button, Typography } from '@douyinfe/semi-ui'; function Demo() { const { Meta } = Card; const { Text } = Typography; return ( } /> } headerExtraContent={ More } cover={ example } footerLine={ true } footerStyle={{ display: 'flex', justifyContent: 'flex-end' }} footer={ } > Semi Design is a design system developed and maintained by IES-FE & IES-UED. ); } ``` ### Inner card Other cards can be nested inside the card. ```jsx live=true dir="column" import React from 'react'; import { Card, Typography } from '@douyinfe/semi-ui'; function Demo() { const { Text } = Typography; return ( More } > Inner Card content More } > Inner Card content ); } ``` ### Card in column The system overview page is often combined with the grid. ```jsx live=true dir="column" import React from 'react'; import { Card, Row, Col } from '@douyinfe/semi-ui'; function Demo() { return (
Card Content Card Content Card Content Card Content Card Content
); } ``` ### loading You can use the `loading` property of `Card` to set whether to display placeholder elements in the card content area. When it is true, the placeholder elements will be displayed, and vice versa. ```jsx live=true dir="column" import React, { useState } from 'react'; import { Card, Switch } from '@douyinfe/semi-ui'; function Demo() { const [loading, setLoading] = useState(true); const { Meta } = Card; return ( <> setLoading(!v) } />

); } ``` ### With Skeleton The `loading` property of `Card` can only set the preloading effect of the content area. If you want to set the preloading of other parts, or customize a richer preloading effect, you can combine it with the Skeleton component. ```jsx live=true dir="column" import React, { useState } from 'react'; import { Card, Switch, Skeleton, Typography, Avatar } from '@douyinfe/semi-ui'; function Demo() { const [loading, setLoading] = useState(true); const { Meta } = Card; const { Title, Paragraph, Image } = Skeleton; return ( <> setLoading(!v) } />

} loading={loading} > Semi Design } description={ } loading={loading} > Semi Design is a design system developed and maintained by IES-FE & IES-UED. } avatar={ } loading={loading}> } /> } headerExtraContent={ } loading={loading}> More } cover={ } loading={loading}> example } > ); } ``` ### With tabs You can use the `Tabs` component in the card component. ```jsx live=true dir="column" import React from 'react'; import { Card, Tabs, TabPane } from '@douyinfe/semi-ui'; function demo() { return (

content1

content1

content1

content2

content2

content2

); } ``` ### Actions `actions` receives the ReactNode array, and the elements will be displayed at the bottom of the content area with a horizontal spacing of 12px. ```jsx live=true dir="column" import React from 'react'; import { Card, Rating } from '@douyinfe/semi-ui'; function Demo() { const { Meta } = Card; return ( ]} headerLine={ false } cover={ example } > ); } ``` ### Card group Use `CardGroup` to present the cards in an evenly spaced arrangement. ```jsx live=true dir="column" import React, { useState } from 'react'; import { Card, CardGroup, Typography, Slider } from '@douyinfe/semi-ui'; function Demo() { const { Text } = Typography; const [ spacing, setSpacing ] = useState(12); return ( <> Slide to adjust the card spacing setSpacing(v)} />
{ new Array(8).fill(null).map((v, idx)=>( More } > Card content )) } ); } ``` ### Grid card You can use the `type` property of `CardGroup` to set the card group to a grid type. ```jsx live=true dir="column" import React from 'react'; import { Card, CardGroup, Typography } from '@douyinfe/semi-ui'; function Demo() { const { Text } = Typography; return ( { new Array(7).fill(null).map((v, idx)=>( More } > Card content )) } ); } ``` ### API reference **Card** |PROPERTIES |INSTRUCTIONS |TYPE |DEFAULT |VERSION| |------------------|-------------------------------------------------------------------------------------|------------------|--------|-------| |actions |Card operation group, located at the bottom of the card content area |Array |- |1.21.0 | |bodyStyle |Body style |CSSProperties |- |1.21.0 | |bordered |Whether to set the outer border of the card |boolean |true |1.21.0 | |className |The className of Card container |string |- |1.21.0 | |cover |Card cover |ReactNode |- |1.21.0 | |headerExtraContent|Extra content to the right of the card title |ReactNode |- |1.21.0 | |footer |Customize card footer |ReactNode |- |1.21.0 | |footerLine |Whether to set borders in the footer area and content area of the card |boolean |false |1.21.0 | |footerStyle |Footer style |CSSProperties |- |1.21.0 | |header |Custom card header, if passed in, it will override `title` and `headerExtraContent` |ReactNode |- |1.21.0 | |headerLine |Whether to set borders in the title area and content area of the card |boolean |true |1.21.0 | |headerStyle |Header style |CSSProperties |- |1.21.0 | |loading |Whether to set a placeholder when loading |boolean |false |1.21.0 | |shadows |Set the time to show the shadow. If this property is not set, there will be no shadow. Optiona: `hover`, `always`|string |- |1.21.0 | |style |Card style |CSSProperties |- |1.21.0 | |title |Card title |ReactNode |- |1.21.0 | **CardGroup** |PROPERTIES |INSTRUCTIONS |TYPE |DEFAULT |VERSION| |-----------|------------------------------------------------------------------------------------------------------------------|-------------------|--------|-------| |className |The className of CardGroup |string |- |1.21.0 | |spacing |Spacing size, support numeric value or array, `[horizontal spacing, vertical spacing]` |number \| number[] |12px |1.21.0 | |style |CardGroup style |CSSProperties |- |1.21.0 | |type |You can set the card deck to a grid type. After setting this property, the `spacing` property will be overwritten.Optional: `grid` |string |- |1.21.0 | **Card.Meta** |PROPERTIES |INSTRUCTIONS |TYPE |DEFAULT |VERSION| |-----------|----------------------|-------------|- |-------| |avatar |avatar |ReactNode |- |1.21.0 | |className |The className of Meta |string |- |1.21.0 | |description|description |ReactNode |- |1.21.0 | |style |Meta style |CSSProperties|- |1.21.0 | |title |title |ReactNode |- |1.21.0 | ## Accessibility - Card supports the input of `aria-label` to indicate the function of the Card - When Card loading, `aria-busy` will be turned on - Card is a container-type component, and any elements inside the card need to follow their respective accessibility guidelines ## Content Guidelines - Card title - Card titles should be informative and focus on the most important information - try to limit the title to 1 phrase or segment - Card titles should be written in sentence case - do not end with punctuation marks (except question marks) - Text - Actionable: Use imperative sentences instead of "you can" to describe the body, which better tells the user what can be done | ✅ Recommended usage | ❌ Deprecated usage | | --- | --- | | Get order progress for details | You can get order progress for details | - Always say the most important information first - Use "Need to" instead of "must" ## Design Tokens