Card
Compound container component for organizing and displaying content with visual hierarchy.
Overview
The Card component is a compound component that provides a flexible container for organizing content with clear visual hierarchy. It uses Shell.Cn() for class merging and renders with rounded-lg border bg-card text-card-foreground shadow-sm styling.
Installation
bash
shellui add card
Usage
Basic Card
Welcome to ShellUI
Build beautiful Blazor applications
Your content goes here.
<Card>
<CardHeader>
<CardTitle>Welcome to ShellUI</CardTitle>
<CardDescription>Build beautiful Blazor applications</CardDescription>
</CardHeader>
<CardContent>
<p>Your content goes here.</p>
</CardContent>
</Card>
Card with Footer
Stats Card
Total Revenue
$$45,231.89
+20.1% from last month
<Card>
<CardHeader>
<div class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium">Total Revenue</CardTitle>
<span class="text-muted-foreground">$</span>
</div>
</CardHeader>
<CardContent>
<div class="text-2xl font-bold">$45,231.89</div>
<p class="text-xs text-muted-foreground">+20.1% from last month</p>
</CardContent>
</Card>
Custom Styling
Each sub-component accepts a Class parameter merged via Shell.Cn():
Compact Card
Card with custom class overrides.
<Card Class="w-[350px]">
<CardHeader Class="pb-2">
<CardTitle>Compact Card</CardTitle>
</CardHeader>
<CardContent Class="text-sm text-muted-foreground">
<p>Card with custom class overrides.</p>
</CardContent>
</Card>
API Reference
Card
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Child sub-components |
Class |
string? |
null |
Additional CSS classes merged via Shell.Cn() |
CardHeader
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Header content (title, description) |
Class |
string? |
null |
Additional CSS classes |
CardTitle
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Title text |
Class |
string? |
null |
Additional CSS classes |
CardDescription
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Description text |
Class |
string? |
null |
Additional CSS classes |
CardContent
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Main card body |
Class |
string? |
null |
Additional CSS classes |
CardFooter
| Parameter | Type | Default | Description |
|---|---|---|---|
ChildContent |
RenderFragment |
— | Footer content (actions) |
Class |
string? |
null |
Additional CSS classes |
Accessibility
- Uses semantic HTML structure for proper screen reader navigation.
- Supports keyboard focus management within interactive card content.
- High contrast border and shadow ensure visual distinction.