Card
A bordered surface for grouped content and actions.
import { Card } from '@elluzion/iv-ui'; 01 Preview
Basic
A title, description, and body content.
Edge cache
Hit rate across the last 24 hours.
98.4% of requests were served from the nearest edge.
Source· svelte Show Hide
<script lang="ts">
import { Card } from '@elluzion/iv-ui';
</script>
<Card title="Edge cache" description="Hit rate across the last 24 hours.">
<p class="body">98.4% of requests were served from the nearest edge.</p>
</Card>
<style>
.body {
margin: 0;
font-family: var(--iv_font-mono);
font-size: var(--iv_text-body);
color: var(--iv_foreground-dim);
}
</style>02 Usage
title,description, andactionbuild the standard header;headerreplaces it.- Providing
onclickmakes the whole card a keyboard-reachable button. footerrenders below the body;padding="none"lets lists manage their own spacing.
03 Examples
Header action
action places a control at the trailing edge of the header.
Deployments
The last three runs for this project.
Refreshed 0 times.
Source· svelte Show Hide
<script lang="ts">
import { Button, Card } from '@elluzion/iv-ui';
let refreshed = $state(0);
</script>
<Card title="Deployments" description="The last three runs for this project.">
{#snippet action()}
<Button size="sm" variant="ghost" onclick={() => refreshed++}>Refresh</Button>
{/snippet}
<p class="body">Refreshed {refreshed} times.</p>
</Card>
<style>
.body {
margin: 0;
font-family: var(--iv_font-mono);
font-size: var(--iv_text-body);
color: var(--iv_foreground-dim);
}
</style>Interactive
onclick adds the button role, tab stop, and keyboard activation.
Open the runbook
Click anywhere on the card, or focus it and press Enter.
Opened 0 times.
Source· svelte Show Hide
<script lang="ts">
import { Card } from '@elluzion/iv-ui';
let opened = $state(0);
</script>
<Card
title="Open the runbook"
description="Click anywhere on the card, or focus it and press Enter."
hoverable
onclick={() => opened++}
>
<p class="body">Opened {opened} times.</p>
</Card>
<style>
.body {
margin: 0;
font-family: var(--iv_font-mono);
font-size: var(--iv_text-body);
color: var(--iv_foreground-dim);
}
</style>States
Selected, hoverable, and disabled treatments.
Selected
Chosen in the current step.
Reverse-video border and cursor marker.
Hoverable
Hover is visual only.
No button role, no tab stop.
Disabled
Interaction is blocked.
Still readable.
Source· svelte Show Hide
<script lang="ts">
import { Card } from '@elluzion/iv-ui';
</script>
<div class="grid">
<Card title="Selected" description="Chosen in the current step." selected>
<p class="body">Reverse-video border and cursor marker.</p>
</Card>
<Card title="Hoverable" description="Hover is visual only." hoverable>
<p class="body">No button role, no tab stop.</p>
</Card>
<Card title="Disabled" description="Interaction is blocked." disabled onclick={() => {}}>
<p class="body">Still readable.</p>
</Card>
</div>
<style>
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--iv_spacing-md);
width: 100%;
}
.body {
margin: 0;
font-family: var(--iv_font-mono);
font-size: var(--iv_text-sm);
color: var(--iv_foreground-dim);
}
</style>04 API
import { Card } from '@elluzion/iv-ui';Props
8 props · 1 events · 4 snippets| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | '' | Title text. |
| description | string | '' | Supporting text. |
| padding | 'sm' | 'md' | 'lg' | 'none' | 'md' | Inner padding. none is useful for lists that manage their own spacing. |
| radius | 'md' | 'lg' | 'md' | Corner radius step. |
| hoverable | boolean | false | Adds the hover treatment without making the card interactive. |
| selected | boolean | false | Renders the selected treatment. |
| disabled | boolean | false | Disables interaction and applies the disabled treatment. |
| className | string | '' | Extra classes merged onto the root element. |
class, id, style, aria-*, and data-* are forwarded through rest props.
Events
| Event | Handler type | Description |
|---|---|---|
| onclick | (e: MouseEvent) => void | Makes the card interactive and called on activation. |
The legacy on:name form is accepted for every event.
Snippets
| Snippet | Type | Description |
|---|---|---|
| children | Snippet | Content rendered inside the component. |
| action | Snippet | Slot in the header, right of the title. |
| header | Snippet | Replaces the default header. |
| footer | Snippet | Content rendered below the body. |
05 Accessibility
| Keys | Action |
|---|---|
| Tab | Moves focus to an interactive card. |
| Enter / Space | Activates an interactive card. |
- An interactive card gets
role="button",tabindex="0", andaria-disabledwhen disabled. - Do not place buttons or links inside a card that is itself clickable; move them to
actionorfooterand keep the card static. hoverablechanges only the visual treatment and does not make the card interactive.
06 Tokens & CSS hooks
Tokens used
--iv_accent --iv_accent-surface --iv_border --iv_border-focus --iv_border-hover --iv_card-pad-x --iv_card-pad-x-lg --iv_card-pad-x-sm --iv_card-pad-y --iv_card-pad-y-lg --iv_card-pad-y-sm --iv_cursor --iv_disabled-opacity --iv_ease-in-out --iv_font-sans --iv_font-ui --iv_foreground --iv_foreground-dim --iv_hazard-stripe --iv_radius --iv_radius-lg --iv_ring --iv_ring-width --iv_spacing-lg --iv_spacing-sm --iv_spacing-xs --iv_surface-raised --iv_text-base --iv_text-label --iv_transition-base
Class hooks
.iv-action.iv-body.iv-card.iv-clickable.iv-description.iv-disabled.iv-footer.iv-header.iv-header-text.iv-hoverable.iv-pad-lg.iv-pad-none.iv-pad-sm.iv-radius-lg.iv-selected.iv-title