Card
A container component for grouping content with unified styling
Basic Cards
Simple card examples with title and description
A basic card with title and description
This is the card content area where you can place any elements.
A card without a description subtitle.
Only description, no title
This card only has a description.
1
2<script lang="ts">
3 import { Card } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
7 <Card title="Simple Card" description="A basic card with title and description">
8 <p class="text-sm">This is the card content area where you can place any elements.</p>
9 </Card>
10
11 <Card title="Without Description">
12 <p class="text-sm">A card without a description subtitle.</p>
13 </Card>
14
15 <Card description="Only description, no title">
16 <p class="text-sm">This card only has a description.</p>
17 </Card>
18</div>Card Variants
Different visual styles for cards
Standard card with border and shadow
The default variant provides a subtle border and light shadow.
Emphasized border
The outline variant uses a thicker border for more emphasis.
Minimal styling
The ghost variant removes borders and shadows for a cleaner look.
Enhanced shadow
The elevated variant adds a larger shadow for depth.
Filled background
The filled variant uses a background color.
1
2<script lang="ts">
3 import { Card } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
7 <Card variant="default" title="Default" description="Standard card with border and shadow">
8 <p class="text-sm">The default variant provides a subtle border and light shadow.</p>
9 </Card>
10
11 <Card variant="outline" title="Outline" description="Emphasized border">
12 <p class="text-sm">The outline variant uses a thicker border for more emphasis.</p>
13 </Card>
14
15 <Card variant="ghost" title="Ghost" description="Minimal styling">
16 <p class="text-sm">The ghost variant removes borders and shadows for a cleaner look.</p>
17 </Card>
18
19 <Card variant="elevated" title="Elevated" description="Enhanced shadow">
20 <p class="text-sm">The elevated variant adds a larger shadow for depth.</p>
21 </Card>
22
23 <Card variant="filled" title="Filled" description="Filled background">
24 <p class="text-sm">The filled variant uses a background color.</p>
25 </Card>
26</div>Padding Options
Different padding sizes for cards
Content fills the entire card with no padding.
Compact card with small padding (p-4).
Standard card with default padding (p-6).
Spacious card with large padding (p-8).
1
2<script lang="ts">
3 import { Card } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-4">
7 <Card padding="none" title="No Padding">
8 <div class="bg-muted p-4 rounded">
9 <p class="text-sm">Content fills the entire card with no padding.</p>
10 </div>
11 </Card>
12
13 <Card padding="sm" title="Small Padding">
14 <p class="text-sm">Compact card with small padding (p-4).</p>
15 </Card>
16
17 <Card padding="default" title="Default Padding">
18 <p class="text-sm">Standard card with default padding (p-6).</p>
19 </Card>
20
21 <Card padding="lg" title="Large Padding">
22 <p class="text-sm">Spacious card with large padding (p-8).</p>
23 </Card>
24</div>Interactive States
Cards with hover and interactive effects
Hover over this card to see the effect
This card responds to hover with enhanced shadow and border color animation.
This card is clickable
Interactive cards have cursor pointer, scale transform, and shadow transitions on hover.
Combining variants with interactive states.
Elevated variant with full interactivity.
Filled background with hover effect.
1
2<script lang="ts">
3 import { Card } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6 md:grid-cols-2">
7 <Card hover title="Hover Effect" description="Hover over this card to see the effect">
8 <p class="text-sm">
9 This card responds to hover with enhanced shadow and border color animation.
10 </p>
11 </Card>
12
13 <Card interactive title="Interactive Card" description="This card is clickable">
14 <p class="text-sm">
15 Interactive cards have cursor pointer, scale transform, and shadow transitions on hover.
16 </p>
17 </Card>
18</div>
19
20<div class="grid gap-6 md:grid-cols-3">
21 <Card variant="outline" hover title="Outline + Hover">
22 <p class="text-sm">Combining variants with interactive states.</p>
23 </Card>
24
25 <Card variant="elevated" interactive title="Elevated + Interactive">
26 <p class="text-sm">Elevated variant with full interactivity.</p>
27 </Card>
28
29 <Card variant="filled" hover title="Filled + Hover">
30 <p class="text-sm">Filled background with hover effect.</p>
31 </Card>
32</div>Header Actions
Cards with action buttons or content in the header
Update your personal information
Manage your API credentials
Keep your API key secure. Never share it publicly.
Control your notification preferences
Toggle application theme
Light mode is enabled
1
2<script lang="ts">
3 import { Card, Button, Field, Input, Badge, Switch } from "@kareyes/aether";
4
5 let emailNotifications = $state(true);
6 let darkMode = $state(false);
7</script>
8
9<Card title="Edit Profile" description="Update your personal information">
10 {#snippet headerAction()}
11 <Button variant="ghost" size="sm">Edit</Button>
12 {/snippet}
13 <div class="space-y-3">
14 <Field label="Full Name">
15 <Input id="full-name" value="John Doe" />
16 </Field>
17 <Field label="Email">
18 <Input id="email" type="email" value="john@example.com" />
19 </Field>
20 </div>
21</Card>
22
23<Card title="Notifications" description="Control your notification preferences">
24 {#snippet headerAction()}
25 <Badge>3 New</Badge>
26 {/snippet}
27 <div class="space-y-3">
28 <Field label="Email notifications" orientation="horizontal">
29 <Switch id="email-notif" bind:checked={emailNotifications} />
30 </Field>
31 </div>
32</Card>
33
34<Card title="Dark Mode" description="Toggle application theme">
35 {#snippet headerAction()}
36 <Switch id="theme-toggle" bind:checked={darkMode} variant="success" />
37 {/snippet}
38 <p class="text-sm text-muted-foreground">
39 {darkMode ? 'Dark mode is enabled' : 'Light mode is enabled'}
40 </p>
41</Card>Footer Content
Cards with footer actions and information
This action requires confirmation
Are you sure you want to proceed? This action cannot be undone.
Update your preferences
Manage your team
John Doe
john@example.com
Jane Smith
jane@example.com
Drag and drop or click to upload
Drop files here or click to browse
1
2<script lang="ts">
3 import { Card, Button, Field, Input } from "@kareyes/aether";
4</script>
5
6<Card title="Confirm Action" description="This action requires confirmation">
7 <p class="text-sm text-muted-foreground">
8 Are you sure you want to proceed? This action cannot be undone.
9 </p>
10 {#snippet footer()}
11 <Button variant="outline" size="sm">Cancel</Button>
12 <Button variant="destructive" size="sm">Confirm</Button>
13 {/snippet}
14</Card>
15
16<Card title="Save Changes" description="Update your preferences">
17 <Field label="Username">
18 <Input id="username-save" value="johndoe" />
19 </Field>
20 {#snippet footer()}
21 <div class="flex-1 text-xs text-muted-foreground">Last saved: 5 minutes ago</div>
22 <Button variant="outline" size="sm">Discard</Button>
23 <Button size="sm">Save</Button>
24 {/snippet}
25</Card>
26
27<Card title="Team Members" description="Manage your team">
28 <div class="space-y-2">
29 <div class="flex items-center gap-3">
30 <div class="h-10 w-10 rounded-full bg-primary/10"></div>
31 <div class="flex-1">
32 <p class="text-sm font-medium">John Doe</p>
33 <p class="text-xs text-muted-foreground">john@example.com</p>
34 </div>
35 </div>
36 </div>
37 {#snippet footer()}
38 <Button variant="outline" size="sm" class="w-full">Invite Member</Button>
39 {/snippet}
40</Card>Complex Examples
Advanced card layouts with multiple features
Manage your subscription and billing
Configure your project preferences
Track your performance metrics
Total Users
12,345
↑ 12% from last month
Revenue
$45,678
↑ 8% from last month
Conversion Rate
3.2%
↓ 2% from last month
Chart visualization would go here
1
2<script lang="ts">
3 import { Card, Button, Field, Select, Switch, Badge } from "@kareyes/aether";
4
5 let autoRenew = $state(true);
6</script>
7
8<Card
9 title="Subscription Plan"
10 description="Manage your subscription and billing"
11 variant="elevated"
12 hover
13>
14 {#snippet headerAction()}
15 <Badge>Active</Badge>
16 {/snippet}
17
18 <div class="space-y-4">
19 <div class="grid gap-4 md:grid-cols-2">
20 <Field label="Current Plan">
21 <Select
22 multiple={false}
23 placeholder="Pro Plan"
24 options={[
25 { value: "free", label: "Free - $0/month" },
26 { value: "pro", label: "Pro - $29/month" },
27 ]}
28 />
29 </Field>
30 </div>
31
32 <Field label="Auto-renew subscription" orientation="horizontal">
33 <Switch id="auto-renew-sub" bind:checked={autoRenew} variant="success" />
34 </Field>
35 </div>
36
37 {#snippet footer()}
38 <div class="flex-1 text-xs text-muted-foreground">Next billing: Dec 1, 2025</div>
39 <Button variant="outline" size="sm">Cancel Plan</Button>
40 <Button size="sm">Upgrade</Button>
41 {/snippet}
42</Card>
43
44<Card
45 title="Analytics Dashboard"
46 description="Track your performance metrics"
47 variant="elevated"
48 padding="lg"
49>
50 {#snippet headerAction()}
51 <div class="flex gap-2">
52 <Button variant="outline" size="sm">Export</Button>
53 <Button variant="outline" size="sm">Refresh</Button>
54 </div>
55 {/snippet}
56
57 <div class="grid gap-6 md:grid-cols-3 mb-6">
58 <div class="rounded-lg bg-muted p-4">
59 <p class="text-sm text-muted-foreground">Total Users</p>
60 <p class="text-3xl font-bold mt-2">12,345</p>
61 </div>
62 </div>
63
64 {#snippet footer()}
65 <div class="flex-1 text-xs text-muted-foreground">Updated: Nov 26, 2025</div>
66 <Button size="sm">View Full Report</Button>
67 {/snippet}
68</Card>Variant Combinations
Combining different props for unique card styles
Minimal card with compact padding.
Emphasized border with spacious padding and hover effect.
Lifted appearance with full interactivity.
Filled background with custom internal padding.
Triple combination for maximum interactivity.
Premium card appearance with generous spacing.
1
2<script lang="ts">
3 import { Card } from "@kareyes/aether";
4</script>
5
6<div class="grid gap-6 md:grid-cols-3">
7 <Card variant="ghost" padding="sm" title="Ghost + Small">
8 <p class="text-sm">Minimal card with compact padding.</p>
9 </Card>
10
11 <Card variant="outline" padding="lg" hover title="Outline + Large + Hover">
12 <p class="text-sm">Emphasized border with spacious padding and hover effect.</p>
13 </Card>
14
15 <Card variant="elevated" interactive title="Elevated + Interactive">
16 <p class="text-sm">Lifted appearance with full interactivity.</p>
17 </Card>
18
19 <Card variant="filled" padding="none" title="Filled + No Padding">
20 <div class="bg-primary/5 p-4 rounded">
21 <p class="text-sm">Filled background with custom internal padding.</p>
22 </div>
23 </Card>
24
25 <Card variant="outline" hover interactive title="Outline + Hover + Interactive">
26 <p class="text-sm">Triple combination for maximum interactivity.</p>
27 </Card>
28
29 <Card variant="elevated" padding="lg" hover title="Elevated + Large + Hover">
30 <p class="text-sm">Premium card appearance with generous spacing.</p>
31 </Card>
32</div>Basic Usage
<script lang="ts">
import { Card } from "@kareyes/aether";
</script>
<Card title="Card Title" description="Card description">
<p>Your card content goes here.</p>
</Card>
With Primitives Import
<script lang="ts">
import { CardPrimitives } from "@kareyes/aether";
</script>
<CardPrimitives.Root>
<CardPrimitives.Header>
<CardPrimitives.Title>Card Title</CardPrimitives.Title>
<CardPrimitives.Description>Card description</CardPrimitives.Description>
</CardPrimitives.Header>
<CardPrimitives.Content>
<p>Your card content goes here.</p>
</CardPrimitives.Content>
</CardPrimitives.Root>
Components
| Component | Description |
|---|---|
Root |
The root container for the card |
Header |
Container for card header content |
Title |
The card title element |
Description |
The card description/subtitle |
Content |
Main content area of the card |
Footer |
Footer area for actions |
Action |
Header action slot |
Props Reference
Card (Shorthand)
| Prop | Type | Default | Description |
|---|---|---|---|
title |
string |
undefined |
Card title text |
description |
string |
undefined |
Card description/subtitle |
variant |
CardVariant |
"default" |
Visual style variant |
padding |
CardPadding |
"default" |
Internal padding size |
hover |
boolean |
false |
Enable hover effects |
interactive |
boolean |
false |
Enable interactive/clickable state |
class |
string |
- | Additional CSS classes |
children |
Snippet |
Required | Main card content |
headerAction |
Snippet |
undefined |
Header action content |
footer |
Snippet |
undefined |
Footer content |
Card Variants
| Variant | Description |
|---|---|
default |
Standard card with border and shadow |
outline |
Card with emphasized border |
ghost |
Minimal card without border or shadow |
elevated |
Card with enhanced shadow for depth |
filled |
Card with filled background |
Card Padding
| Padding | Size | Description |
|---|---|---|
none |
0 | Full-bleed content, custom padding |
sm |
p-4 | Compact cards |
default |
p-6 | Standard spacing |
lg |
p-8 | Spacious layouts |
Variants
Default
Standard card with border and shadow:
<Card variant="default" title="Default Card">
<p>Standard card with border and shadow.</p>
</Card>
Outline
Card with emphasized border:
<Card variant="outline" title="Outline Card">
<p>Card with emphasized border.</p>
</Card>
Ghost
Minimal card without border or shadow:
<Card variant="ghost" title="Ghost Card">
<p>Minimal card without border or shadow.</p>
</Card>
Elevated
Card with enhanced shadow for depth:
<Card variant="elevated" title="Elevated Card">
<p>Card with enhanced shadow for depth.</p>
</Card>
Filled
Card with filled background:
<Card variant="filled" title="Filled Card">
<p>Card with filled background.</p>
</Card>
Examples
Hover Effects
<Card
title="Hover Card"
description="Hover to see effect"
hover={true}
>
<p>This card responds to hover with enhanced shadow and border color.</p>
</Card>
Interactive/Clickable Cards
<script lang="ts">
import { Card } from "@kareyes/aether";
function handleCardClick() {
alert('Card clicked!');
}
</script>
<Card
title="Interactive Card"
description="This card is clickable"
interactive={true}
onclick={handleCardClick}
>
<p>Click anywhere on this card to trigger an action.</p>
</Card>
Card with Header Actions
<script lang="ts">
import { Card, Button } from "@kareyes/aether";
</script>
<Card title="Edit Profile" description="Update your information">
{#snippet headerAction()}
<Button variant="ghost" size="sm">Edit</Button>
{/snippet}
<p>Profile content goes here.</p>
</Card>
Card with Footer
<script lang="ts">
import { Card, Button } from "@kareyes/aether";
</script>
<Card title="Confirm Action" description="This requires confirmation">
<p>Are you sure you want to proceed?</p>
{#snippet footer()}
<Button variant="outline" size="sm">Cancel</Button>
<Button variant="destructive" size="sm">Confirm</Button>
{/snippet}
</Card>
Complex Card with Header and Footer
<script lang="ts">
import { Card, Button, Badge, Field, Input } from "@kareyes/aether";
</script>
<Card
title="Subscription Plan"
description="Manage your subscription"
variant="elevated"
hover={true}
>
{#snippet headerAction()}
<Badge>Active</Badge>
{/snippet}
<Field.Impl label="Plan">
<Input value="Pro Plan" />
</Field.Impl>
{#snippet footer()}
<div class="flex-1 text-xs text-muted-foreground">
Next billing: Dec 1, 2025
</div>
<Button variant="outline" size="sm">Cancel</Button>
<Button size="sm">Upgrade</Button>
{/snippet}
</Card>
Using Native Card Components
For more control, use the native card components:
<script lang="ts">
import { CardPrimitives } from "@kareyes/aether";
</script>
<CardPrimitives.Root class="border rounded-xl shadow-sm">
<CardPrimitives.Header>
<CardPrimitives.Title>Custom Card</CardPrimitives.Title>
<CardPrimitives.Description>Using native components</CardPrimitives.Description>
<CardPrimitives.Action>
<button>Action</button>
</CardPrimitives.Action>
</CardPrimitives.Header>
<CardPrimitives.Content>
<p>Your content here</p>
</CardPrimitives.Content>
<CardPrimitives.Footer>
<button>Footer Action</button>
</CardPrimitives.Footer>
</CardPrimitives.Root>
Settings Card
<script lang="ts">
import { Card, Field, Switch } from "@kareyes/aether";
</script>
<Card
title="Notification Settings"
description="Manage your notification preferences"
>
<Field.Impl label="Email notifications" orientation="horizontal">
<Switch id="email" />
</Field.Impl>
<Field.Impl label="Push notifications" orientation="horizontal">
<Switch id="push" />
</Field.Impl>
</Card>
Stats Card
<Card variant="elevated" padding="lg">
<div class="text-center">
<p class="text-sm text-muted-foreground">Total Users</p>
<p class="text-4xl font-bold mt-2">12,345</p>
<p class="text-xs text-green-600 mt-1">↑ 12% from last month</p>
</div>
</Card>
Product Card
<script lang="ts">
import { Card, Button } from "@kareyes/aether";
</script>
<Card
title="Premium Plan"
description="Best for teams"
variant="outline"
interactive={true}
>
<div class="space-y-2">
<p class="text-3xl font-bold">$29/month</p>
<ul class="space-y-1 text-sm">
<li>✓ Unlimited projects</li>
<li>✓ Advanced analytics</li>
<li>✓ Priority support</li>
</ul>
</div>
{#snippet footer()}
<Button class="w-full">Get Started</Button>
{/snippet}
</Card>
Accessibility
The Card component follows accessibility best practices:
Semantic Structure
- Cards use semantic HTML structure
- Proper heading hierarchy with Title component
- Interactive cards have proper cursor styles
Best Practices
- Use descriptive titles: Card titles should clearly indicate the content
- Maintain focus order: Header actions and footer buttons maintain proper focus order
- Interactive feedback: Use
hoverandinteractiveprops to indicate interactivity - Color contrast: All variants support proper color contrast in light and dark modes
Styling Notes
- Cards use
bg-cardandtext-card-foregroundcolor tokens for theming - The
rounded-xlclass provides consistent border radius - Shadow utilities create depth hierarchy
- All variants support dark mode through color tokens