Card
Spring collection
A surface for grouped content: a media card (image/icon + title + description + tags/actions) or a dashboard metric tile (value + change/trend).
Import
Section titled “Import”<script> import Card from "@invisible-ui/svelte/Card.svelte";</script><script setup> import { Card } from "@invisible-ui/vue";</script>import { Card } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-card></ds-card>| Prop | Type | Default | Description |
|---|---|---|---|
variant | "media" | "dashboard" | "media" | Media card or metric tile. |
orientation | "vertical" | "horizontal" | "vertical" | Media layout. |
surface | "default" | "secondary" | "default" | Surface hierarchy. secondary uses the quieter secondary card surface token. |
imageSrc | string | undefined | undefined | Media image (falls back to the icon snippet). |
imageAlt | string | "" | Media image (falls back to the icon snippet). |
title | string | Snippet | undefined | undefined | Heading: text, or a snippet for rich content. Only a text title names the card. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Heading level for the title. |
description | string | Snippet | undefined | undefined | Body text, or a snippet for rich content. |
value | string | number | undefined | undefined | Dashboard metric value. |
change | string | undefined | undefined | Dashboard delta (e.g. "+12.5%"). |
trend | "up" | "down" | "neutral" | "neutral" | Tints the change. |
icon | Snippet | undefined | undefined | Icon in the media area (media variant) or beside the title (dashboard). |
media | Snippet | undefined | undefined | Custom media content, in place of the image or icon. |
tags | Snippet | undefined | undefined | Tags shown with the title. |
metric | Snippet | undefined | undefined | Dashboard: extra content after the value and change. |
actions | Snippet | undefined | undefined | Actions area at the end of the card. |
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "media" | "dashboard" | "media" | media (default): image/icon, text and actions. dashboard: a metric tile. |
orientation | "vertical" | "horizontal" | "vertical" | Media card layout. Defaults to vertical. |
surface | "default" | "secondary" | "default" | Surface hierarchy. secondary uses the quieter secondary card surface token. |
imageSrc | string | undefined | Image URL for the media area (ignored when the icon slot is used). |
imageAlt | string | "" | Alt text for the image. Defaults to empty (decorative). |
title | string | undefined | Card title; rendered as a heading and used to label the card. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Heading level for the title (2-6). Defaults to 3. |
description | string | undefined | Body description text (override with the description slot for rich content). |
value | string | number | undefined | Dashboard: the large metric value. |
change | string | undefined | Dashboard: the smaller change/percentage shown beside the value. |
trend | "up" | "down" | "neutral" | "neutral" | Dashboard: direction of the change, for coloring. |
Slots: actions, default, description, icon, media, metric, tags, title.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "media" | "dashboard" | "media" | media (default): media, text and actions. dashboard: a metric tile. |
orientation | "vertical" | "horizontal" | "vertical" | Media card layout. Defaults to vertical. |
surface | "default" | "secondary" | "default" | Surface hierarchy. secondary uses the quieter secondary card surface. |
imageSrc | string | — | Image URL for the media area, used as given (ignored with icon or media). |
imageAlt | string | "" | Alt text for the image. Empty by default (decorative). |
title | ReactNode | — | Card title. A string renders as a heading and names the card; other markup replaces the heading. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Heading level for a string title (2 to 6). Defaults to 3. |
description | ReactNode | — | Body description: text or markup. |
value | string | number | — | Dashboard: the large metric value. |
change | string | — | Dashboard: the smaller change shown beside the value. |
trend | "up" | "down" | "neutral" | "neutral" | Dashboard: direction of the change, for its colour. |
icon | ReactNode | — | Decorative icon in the media area (media) or beside the title (dashboard). |
media | ReactNode | — | Custom media, in place of the image or the icon. |
tags | ReactNode | — | Tags shown with the title. |
metric | ReactNode | — | Dashboard: extra content after the value and the change. |
actions | ReactNode | — | Actions at the end of the card. |
children | ReactNode | — | Extra body content below the description. |
| Attribute | Reactive | Description |
|---|---|---|
variant | yes | media or dashboard |
orientation | yes | vertical or horizontal |
surface | yes | default or secondary |
image-src | yes | |
image-alt | yes | |
title | yes | |
heading-level | yes | |
description | yes | |
value | yes | |
change | yes | |
trend | yes | up, down, or neutral |
Reactive attributes re-render the element when they change after the first render.
Snippets: media, icon, tags, actions, children (body content),
metric. title and description take plain text or a snippet.
The image src is rendered as given: pass only URLs you trust or have
sanitized. See Security.
Example
Section titled “Example”<Card variant="dashboard" title="Revenue" value="€48,200" change="+12.5%" trend="up" />In Elements, text values use attributes and rich regions stay in light DOM.
Mark region content with slot; unslotted children become the body:
<ds-card title="Database" description="AdventureWorks" orientation="horizontal"> <ds-tag slot="tags" status="success">Connected</ds-tag> <p>12 tables available.</p> <ds-button slot="actions">Open</ds-button></ds-card>Use surface="secondary" for a card that belongs to the secondary surface
hierarchy. It resolves through --ds-components-card-secondary-background-default, a component
token that points at the neutral surface role in the light theme and at Grey
900 in the dark one. The default surface resolves through
--ds-components-card-background-default.
In React, title, description, icon, media, tags, metric and
actions take markup:
<Card title="Analytics" description="Live data from the warehouse." tags={<Tag status="success">Connected</Tag>} actions={<Button>Open</Button>}/>Themeable via --ds-card-*.