Skip to content
Harness Design System Harness Design System Harness Design System

Card

beta

The Card component provides a flexible UI element for displaying content within a card layout. It supports various configurations such as sizes, orientations, and the position of the image relative to the content.

Usage

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

Sizes

The Card component supports three sizes: sm, default, and md. 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 and disabled states:

API Reference

Root

The root component for the card.

<Card.Root
orientation="vertical" // [OPTIONAL] Orientation of the card
position="start" // [OPTIONAL] Position of the image
size="default" // [OPTIONAL] Size of the card
selected={false} // [OPTIONAL] Whether the card is selected
disabled={false} // [OPTIONAL] Whether the card is disabled
className="custom-class" // [OPTIONAL] Custom class name
>
{/* Card content */}
</Card.Root>
PropRequiredDefaultType
orientationfalse'vertical''vertical' | 'horizontal'
positionfalse'start''start' | 'end'
sizefalse'default''sm' | 'default' | 'lg'
selectedfalsefalseboolean
disabledfalsefalseboolean
classNamefalsestring

Image

The image component for the card.

<Card.Image
src="/path/to/image.jpg"
alt="Image description"
width={300} // [OPTIONAL] Image width
height={200} // [OPTIONAL] Image height
className="custom-class" // [OPTIONAL] Custom class name
/>
PropRequiredDefaultType
widthfalsenumber | string
heightfalsenumber | string
classNamefalsestring

Title

The title component for the card.

<Card.Title
as="h3" // [OPTIONAL] Heading level (h1-h6)
className="custom-class" // [OPTIONAL] Custom class name
>
Card Title
</Card.Title>
PropRequiredDefaultType
asfalse'h3''h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
classNamefalsestring

Content

The content component for the card.

<Card.Content
className="custom-class" // [OPTIONAL] Custom class name
>
{/* Card content */}
</Card.Content>
PropRequiredDefaultType
classNamefalsestring