Skip to content

Card ​

A surface for grouping related content with optional header and footer actions. Toggle Vue / CSS to switch the live demo and source together.

The look is Basecoat's .card (see Theme): a --card surface at rounded-xl, edged with a 1px --foreground/10 ring rather than a border (drawn inside the box, so no clipping ancestor can eat it), an xs shadow and text-sm type, with gap-6 py-6 and every region inset px-6 so a media band can run full-bleed between them. Dark mode is built in.

Basic ​

Simple card with optional title and subtitle.

Vue SFC

Title & subtitle ​

The header text comes from three places. When more than one is given, the most specific wins:

  1. slot="header" replaces the whole left side of the header: the icon, the title and the subtitle.
  2. slot="title" / slot="subtitle" each replace one line.
  3. title / subtitle props are plain text.

The old prop names heading / subheading are still accepted as aliases of title / subtitle.

Vue SFC

Nested ​

Cards stack freely inside other cards β€” including behind v-if / v-for and while dynamic content mounts.

Vue SFC

Colors ​

Pick a colour and every variant takes it. Elevated, outlined, flat, tonal and glass looks. outlined is Basecoat's .card exactly (the ring plus an xs shadow); elevated β€” the default β€” swaps that shadow for md. The gradient variant was removed with the Basecoat port: the design system has no colour gradients, and tonal is the tinted surface that replaces it.

The colour accents the ring and the title (tonal tints its whole surface); neutral β€” the default β€” leaves the card unpainted.

Vue SFC

States ​

Bordered, hoverable, clickable and disabled.

Vue SFC

Actions ​

Footer actions slot with multiple buttons.

Vue SFC

Event: click ​

Listen for click on a clickable card.

Vue SFC

Event: toggle ​

Use the click event to switch the card variant.

Vue SFC

Event log ​

Live log of click events, distinguishing mouse vs keyboard.

Vue SFC

Dynamic content ​

v-if, v-else-if, v-for, <template> blocks and <Teleport> work normally inside a card (including the "empty card that fills once a query resolves" shape). Wrap a bare v-if child in a <template> or a stable element, or use mono-helper/ui/shadow/card for no constraints.

Customized ​

Override per-element styling with the cssClass prop (Vue) or extra utility classes (CSS).

Vue SFC

Sizes ​

size sets the content scale β€” padding, title and subtitle type, the header / actions / subtitle gaps and the header icon box β€” across xs, sm, md (default), lg, xl and xxl. It does not change the card's width β€” every card in the demo below is the same width, only the density inside differs. Use width when you want a different measure, so a compact xs card can still be wide. Corner radius stays with rounded.

Changed

size used to be a 3-step density scale (compact / md / comfortable) that only changed the padding. compact is roughly sm and comfortable roughly lg; md is unchanged, so cards that never set size look exactly the same.

Vue SFC

Width & height ​

Set width, height, min-width, max-width, min-height or max-height β€” each takes a CSS string ("320px", "80%") or a number (px). Use width="100%" for a full-width card (replaces the old fullWidth).

Vue SFC

CSS Variables ​

Vue SFC

Themed through --mono-card-* custom properties (they inherit and pierce the shadow boundary); an explicit --mono-card-* override wins over the size / rounded / color props. To re-skin globally, set the underlying tokens (--card, --foreground, --primary …) β€” or switch flavor.

VariableDefaultControls
--mono-card-bg / --mono-card-text / --mono-card-subtext--card / --card-foreground / --muted-foregroundSurface, body ink, subtitle ink
--mono-card-ring-color / -ring-width--foreground/10 / --mono-border-widthThe card's edge. Basecoat rings the card rather than bordering it, but draws that ring OUTSIDE the box, where any clipping ancestor (a stage with overflow: hidden, a scroller, the viewport itself) eats it β€” so mono draws the same hairline as an outline with a negative offset: inside the box, painted above a full-bleed media band, and unclippable. bordered adds a real border on top
--mono-card-border-color / -border-width--border / --mono-border-widthThat extra border, when bordered
--mono-card-divider-color--borderHeader / footer divider
--mono-card-radius--mono-radius-xlCorner (set by rounded, not size)
--mono-card-shadow / -shadow-elevated / -shadow-hoverxs / md / lgResting, elevated and hover elevation
--mono-card-padding-<size> (or -padding for all)6 Γ— --mono-spacing at md, 4 at smBlock padding and every region's inset
--mono-card-gap-<size> (or -gap)same as the paddingGap between regions
--mono-card-header-gap-<size> / -actions-gap-<size>1 Γ— / 2 Γ— --mono-spacingTitle↔subtitle gap / action gap
--mono-card-font-<size> / -title-font-<size> / -subtitle-font-<size>--mono-text-sm / --mono-text-base / --mono-text-smBody, title and subtitle type
--mono-card-title-font-weight / -title-tracking / -title-transform / --mono-card-title-color--mono-font-weight-medium / normal / none / the accent when color is setTitle weight, tracking, case and ink (the sera flavor sets all three)
--mono-card-accent--neutral (set by color)Ring tint, title tint, icon box, spinner
--mono-card-icon-size-<size> / --mono-card-icon-glyph / --mono-card-icon-radius9 Γ— --mono-spacing / 55% / --mono-radius-mdHeader icon box
--mono-card-focus-ring-color / -width / -alpha--ring / --mono-ring-width / --mono-ring-alphaFocus-visible ring
--mono-card-loading-bg / -loading-blur / -spinner-size / -spinner-width / -spinner-speed--card/58 / 2px / 22px / 2px / 0.65sLoading veil and spinner
--mono-card-glass-bg / -glass-border / -glass-blur--card/45 / --foreground/12 / 12pxglass variant

Deprecated and honoured as no-ops until 2.0: --mono-card-accent-rgb and the --mono-card-{primary,secondary,…} palette mirrors (read the role tokens instead), --mono-card-bg-soft, --mono-card-border-soft (use -divider-color), --mono-card-elevated-border-color, --mono-card-hover-lift (Basecoat does not lift on hover), --mono-card-focus-ring-offset, --mono-card-subtitle-gap (the header is a grid with one gap), --mono-card-icon-inner-size (use -icon-glyph), and every --mono-card-gradient-*.

Types ​

Importimport { CardProps } from 'mono-helper'
PropValueDefaultDescription
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'β€”Content scale β€” padding, type, gaps and the header icon. Not a dimension: use `width` / `height` for that. See {@link CardSize}.
variant'tonal' | 'elevated' | 'outlined' | 'flat' | 'glass'β€”Visual style variant of the card.
color'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'teal' | 'purple' | 'neutral' | 'dark' | 'light'β€”Color theme of the card.
rounded'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'none' | 'full'β€”Corner radius of the card.
mediaPosition'top' | 'bottom'β€”Position of the media slot (top or bottom).
titlestringβ€”Title text shown in the card header. `slot="title"` replaces it, and `slot="header"` replaces the icon, title and subtitle together.
subtitlestringβ€”Subtitle text shown under the title. `slot="subtitle"` replaces it.
headingstringβ€”β€”
subheadingstringβ€”β€”
borderedbooleanβ€”Adds a border around the card.
hoverablebooleanβ€”Adds a hover elevation effect.
clickablebooleanβ€”Makes the card interactive and clickable.
selectedbooleanβ€”Applies the selected highlight state.
disabledbooleanβ€”Disables interaction and dims the card.
loadingbooleanβ€”Shows a loading overlay on the card.
widthstring | numberβ€”Explicit sizing. Each accepts a CSS length string (`"320px"`, `"80%"`) or a number (interpreted as px). Use `width="100%"` for a full-width card.
heightstring | numberβ€”β€”
minWidthstring | numberβ€”β€”
maxWidthstring | numberβ€”β€”
minHeightstring | numberβ€”β€”
maxHeightstring | numberβ€”β€”
headerDividerbooleanβ€”Shows a divider below the header.
footerDividerbooleanβ€”Shows a divider above the footer.
hrefstringβ€”Renders the card as an anchor with this URL.
targetstringβ€”Anchor target window when href is set.
ariaLabelTextstringβ€”Accessible label text for screen readers.
ariaLabelstringβ€”β€”
cssClassCardCssClassβ€”Per-element class overrides.