Card

Separates content into sections.

Card

To implement Card component into your project you’ll need to the import at least the Card and the CardSection:

import Card, { CardSection } from "@kiwicom/orbit-components/lib/Card";

After adding import into your project you can use it simply like:

<Card>
<CardSection>Hello World!</CardSection>
</Card>

Props

Table below contains all types of the props available in the Card component.

NameTypeDefaultDescription
actionsReact.NodeOptional prop for Action components in header of Card
childrenReact.NodeThe content of the Card. You can use only CardSection
dataTeststringOptional prop for testing purposes
idstringSet id for Card
descriptionReact.NodeThe description of the Card
headerReact.NodeThe header of the Card. Useful when you need different layout then combination of eg title and description
iconReact.NodeDisplay icon on the left
loadingbooleanIf true Loading will be rendered
onClose() => void \| PromiseCallback that is triggered when Card is closing
spaceAfterenumAdditional margin-bottom after component. See this docs
titleReact.NodeThe title of the Card
titleAsenum"h2"The element used for the root node of the title of Card.

CardSection

import Card, { CardSection } from "@kiwicom/orbit-components/lib/Card";

Usage:

<Card>
<CardSection>Hello World!</CardSection>
</Card>

Props

NameTypeDefaultDescription
actionsReact.NodeActions which will be rendered on the right side
childrenReact.NodeThe content of the CardSection.
dataTeststringOptional prop for testing purposes.
descriptionReact.NodeThe description of the CardSection
expandablebooleanfalseIf true, the CardSection will be expandable.
expandedbooleanIf you pass either true or false the CardSection component will controlled component and you will have to manage the state via onExpand or onClose
headerReact.NodeThe header of the CardSection. Useful when you need different layout than combination of e.g. title and description properties.
iconReact.NodeDisplayed icon on the left side of the CardSection.
initialExpandedbooleanfalseInitial state of expandable CardSection when it mounts in uncontrolled variant
noSeparatorBooleanOptional prop to turn off Separator between header and children
onClickevent => void \| PromiseFunction for handling the onClick event.
onClose() => void \| PromiseCallback that is triggered when section is closing
onExpand() => void \| PromiseCallback that is triggered when section is expanding
titleReact.NodeThe title of the CardSection
titleAsenum"h2"The element used for the root node of the title of CardSection.

enum

titleAs
"h1"
"h2"
"h3"
"h4"
"h5"
"h6"
"div"