Skip to content

Card

The Card component provides a flexible container for displaying content within a card layout. It’s composed from four parts — Root, Image, Title, and Content — and supports various configurations such as sizes, orientations, and the position of the image relative to the content.

Variations

Sizes

The Card component supports three sizes: sm, md, and lg. The size prop does not actually change the size of the card, but rather the padding and border radius.

Orientation

The Card component supports two orientations: vertical and horizontal. The orientation determines how the card’s content is laid out.

Image position

The position prop controls where the image is placed within the card layout. It supports two values: start and end.

States

The Card component supports selected, disabled, and interactive states:

Installation

import { Card } from '@harnessio/ui/components'
return (
<Card.Root orientation="vertical" position="start">
<Card.Image src="/card-image.png" alt="" />
<Card.Title>Card Title</Card.Title>
<Card.Content>
Card content goes here
</Card.Content>
</Card.Root>
)