GitHub repository

Card

Titled panel container.

A bordered panel with an optional title (string or snippet), meta, description, and action slot, plus full-bleed `media` and a `footer` band. Becomes a link (`href`) or button (`onclick`) when interactive, with keyboard activation. `outlined` or `elevated` surface; the title renders at a configurable heading level for a correct document outline.

Demo

live · storybook Open in Storybook

Demo loads from https://dssoca-storybook.vercel.app/. Run pnpm storybook for it to render locally.

Usage

svelte
<script>
  import { Card } from 'dssoca';
</script>

<Card title="Services" meta="6 of 7 healthy"
  description="last sync 2m ago" variant="elevated">
  …content…
  {#snippet footer()}view all{/snippet}
</Card>

HTML

CSS only — static markup The exact markup the component renders, generated at build time. Use it with dssoca/vanilla.css — see Plain HTML & CSS.

html
<div class="ss-card" aria-labelledby="card-s1">
  <div class="head">
    <div class="heading">
      <div class="title" id="card-s1" role="heading" aria-level="3">Uptime</div>
    </div>
    <div class="actions">
      <div class="meta">24h</div>
    </div>
  </div>
  <div class="body">
    <p>All systems nominal.</p>
  </div>
</div>

Props

PropTypeDefaultDescription
titlestring | Snippet—Heading text, or a Snippet for inline icons/badges in the title.
metastring—Secondary label rendered to the right of the title.
descriptionstring—Muted description rendered under the heading.
actionSnippet—Header controls (buttons, menus) rendered to the right.
mediaSnippet—Full-bleed visual above the head (zero side padding).
footerSnippet—Footer band mirroring the head, rendered only when provided. Typically holds an action row (e.g. a secondary `ghost` + primary `Button`); the band is a `space-between` flex row, so wrap multiple actions in a single element to group (and left-align) them.
hrefstring—Makes the whole card a primary link to this href.
externalbooleanfalseOff-site `href`: the overlay link opens in a new tab with `rel="noopener noreferrer"` and announces "(opens in a new tab)" (Sidebar's `external` convention).
onclick(e: MouseEvent | KeyboardEvent) => void—Makes the whole card clickable; pairs with keyboard activation.
variant'outlined' | 'elevated''outlined'Surface style (elevated uses shadow tokens).
titleLevelnumber3Heading level (aria-level) for the title.
size'sm' | 'md' | 'lg'—Per-instance size override; inherits the ancestor `data-size-variant` when unset.
childrenSnippet—Required. Panel body.
↑↓ navigate · ↵ open · esc close

Keyboard shortcuts

No shortcuts registered

Shortcuts added through the dssoca registry will show up here.

Single-key shortcuts