Cards
Cards are used to display information in a visually consistent manner. Click UI provides several card variants: Primary Card for highlighting key information, Secondary Card for supplementary content, Horizontal Card for side-by-side layouts, and Promotion Card for promotional messages.
Primary Card
Primary Card is used to highlight key information or actions, drawing attention to important content within a layout in a visually consistent manner.
Example
Card title
A description very interesting that presumably relates to the card.
Props
Prop | Type | Default value | Description |
|---|---|---|---|
Prop title | Type string | Default value "" | Description The title text displayed in the card |
Prop description | Type string | Default value "" | Description The description text displayed below the title |
Prop alignContent | Type "start" | "center" | "end" | Default value "center" | Description The horizontal alignment of the card content |
Prop infoUrl | Type string | Default value "" | Description URL for the info link displayed at the bottom of the card |
Prop infoText | Type string | Default value "Learn more" | Description The text displayed for the info link |
Prop size | Type "sm" | "md" | "lg" | Default value "md" | Description The size of the card |
Prop hasShadow | Type boolean | Default value false | Description If true, the card will have a drop shadow |
Prop topBadgeText | Type string | Default value "" | Description Text to display in the top badge |
Prop topBadgeState | Type "default" | "success" | "neutral" | "danger" | "disabled" | "warning" | "info" | Default value "default" | Description The visual state of the top badge |
Prop icon | Type IconName | Default value "" | Description Icon name to display in the card |
Quick Start
import { CardPrimary } from '@clickhouse/click-ui'
function MyCardPrimary() {
return (
<CardPrimary
title="Card Title"
description="A description that relates to the card."
icon="building"
infoUrl="https://clickhouse.com"
infoText="Learn more"
/>
)
}Secondary Card
Secondary Card is used for supplementary information or actions, providing a more subtle visual treatment compared to Primary Card.
Example
Props
Prop | Type | Default value | Description |
|---|---|---|---|
Prop title | Type string | Default value "" | Description The title text displayed in the card |
Prop description | Type string | Default value "" | Description The description text displayed below the title |
Prop alignContent | Type "start" | "center" | "end" | Default value "center" | Description The horizontal alignment of the card content |
Prop infoUrl | Type string | Default value "" | Description URL for the info link displayed at the bottom of the card |
Prop infoText | Type string | Default value "Learn more" | Description The text displayed for the info link |
Prop size | Type "sm" | "md" | "lg" | Default value "md" | Description The size of the card |
Prop hasShadow | Type boolean | Default value false | Description If true, the card will have a drop shadow |
Prop topBadgeText | Type string | Default value "" | Description Text to display in the top badge |
Prop topBadgeState | Type "default" | "success" | "neutral" | "danger" | "disabled" | "warning" | "info" | Default value "default" | Description The visual state of the top badge |
Prop icon | Type IconName | Default value "" | Description Icon name to display in the card |
Prop iconUrl | Type string | Default value "" | Description URL of an image to display as the icon |
Horizontal Card
Horizontal Card displays content in a side-by-side layout, ideal for showcasing items with images and descriptions.
Example
Props
Prop | Type | Default value | Description |
|---|---|---|---|
Prop title | Type string | Default value "" | Description The title text displayed in the card |
Prop description | Type string | Default value "" | Description The description text displayed below the title |
Prop alignContent | Type "start" | "center" | "end" | Default value "start" | Description The horizontal alignment of the card content |
Prop infoUrl | Type string | Default value "" | Description URL for the info link displayed at the bottom of the card |
Prop infoText | Type string | Default value "Learn more" | Description The text displayed for the info link |
Prop size | Type "sm" | "md" | "lg" | Default value "md" | Description The size of the card |
Prop hasShadow | Type boolean | Default value false | Description If true, the card will have a drop shadow |
Prop topBadgeText | Type string | Default value "" | Description Text to display in the top badge |
Prop topBadgeState | Type "default" | "success" | "neutral" | "danger" | "disabled" | "warning" | "info" | Default value "default" | Description The visual state of the top badge |
Prop iconUrl | Type string | Default value "" | Description URL of an image to display as the icon |
Promotion Card
CardPromotion is a promotional card component that displays a label with an icon, often used for notifications, alerts, or important messages.
Example
Basic Promotion
Dismissible Promotion
Props
Prop | Type | Default value | Description |
|---|---|---|---|
Prop label | Type string | Default value "" | Description The text label for the card |
Prop icon | Type IconName | Default value "" | Description Icon name to display in the card |
Prop dismissible | Type boolean | Default value false | Description Whether the card can be dismissed |
Quick Start
import { CardPrimary, CardSecondary, CardHorizontal, CardPromotion } from '@clickhouse/click-ui'
function MyCards() {
return (
<div>
<CardPrimary
title="Primary Card"
description="This is a primary card."
icon="building"
/>
<CardSecondary
title="Secondary Card"
description="This is a secondary card."
icon="building"
/>
<CardHorizontal
title="Horizontal Card"
description="This is a horizontal card."
iconUrl="https://example.com/icon.png"
/>
<CardPromotion
label="Promotion"
icon="star"
/>
</div>
)
}Related Components
- Panel: For simple containers without card styling.
- Container: For organizing multiple cards in layouts.
- Badge: Often used within cards for status indicators.
- Icon: Used in cards for visual elements.
Common Use Cases
Dashboard Cards
Total Revenue
$125,000 this month
Active Users
1,234 active users
import { CardPrimary, Container } from '@clickhouse/click-ui'
function DashboardCards() {
return (
<Container orientation='horizontal' gap='md' wrap='wrap'>
<CardPrimary
icon='chart'
title='Total Revenue'
description='$125,000 this month'
/>
<CardPrimary
icon='users'
title='Active Users'
description='1,234 active users'
/>
</Container>
)
}Feature Cards
import { CardSecondary, Container } from '@clickhouse/click-ui'
function FeatureCards() {
return (
<Container orientation='horizontal' gap='md' wrap='wrap'>
<CardSecondary
icon='feature1'
title='Feature 1'
description='Description of feature 1'
infoUrl='https://clickhouse.com'
infoText='Learn more'
/>
</Container>
)
}Product Cards
import { CardHorizontal } from '@clickhouse/click-ui'
function ProductCards() {
return (
<CardHorizontal
iconUrl='https://example.com/product.png'
title='Product Name'
description='Product description.'
infoUrl='https://clickhouse.com'
infoText='View Details'
topBadgeText='New'
topBadgeState='success'
/>
)
}