Skip to content

GkCard

A card primitive for admin layouts: a bordered, rounded surface (optional top media) with optional title / subtitle / text convenience props, slots for full composition, and GkCardActions for a footer action row. The API and layout are inspired by Vuetify’s VCard; the implementation is God Kit–native (Vue SFCs, var(--gk-*) tokens, no Vuetify runtime).

When to use

  • Dashboard tiles, feed items, and lists of entities (with GkDataTable or custom grids) where you need a consistent surface.
  • Teasers with an image, headline, and CTA row (GkButton inside GkCardActions).
  • Navigable tiles as a link (href) or a clickable div with role="button" when you need a single surface action without nested links.

For modal workflows, use GkDialog. For a flex region without a full card chrome, use GkStack or GkContainer.

Live Examples

Basic elevated card

Use the default slot for simple content.

Default elevated surface with design-token border and shadow.

Best practice: Start with the default elevated variant for dashboard cards, then change variant only when the surface hierarchy requires it.

Convenience title, subtitle, and text

Use props for the common header/body layout.

Invoice #1042

Acme Corp - due in 3 days

The amount is ready for review.
Extra paragraph in the default slot.

Best practice: Use title/subtitle/text props for simple cards; switch to slots when the header needs custom markup.

Media and actions

Add top media and a footer action row.

Landscape

Picsum sample media

Top media uses object-fit: cover and a token min-height.

Best practice: Wrap action buttons in GkCardActions so spacing and alignment stay consistent across cards.

Header slots

Use slots for custom prepend, title, subtitle, and append regions.

Custom title slot

With a color chip in prepend

New
Use #prepend and #append for icons, avatars, or status chips.

Best practice: Use #prepend and #append for visual metadata such as icons, avatars, status dots, or lightweight badges.

Link card

Use href for navigation so the root is a real anchor.

Best practice: Do not place buttons or other nested interactive controls inside a linked card.

Clickable surface

Use clickable when the whole card is a single non-navigation action.

Best practice: Prefer href for navigation; use clickable for in-page actions and keep nested controls out of the card.

Loading, disabled, and variants

Combine state props with visual variants.

Loading compact card

The toggle is outside the card to avoid nested interactive controls.

Disabled + tonal

Tonal background with no lift.

Best practice: Keep loading toggles outside the card when the card itself is busy; disabled cards are not interactive.

API

GkCard — props

PropTypeDefaultDescription
variant'elevated' | 'outlined' | 'tonal' | 'plain''elevated'elevated: surface + token shadow. outlined: border, no default shadow. tonal: primary-tinted fill. plain: no border, transparent.
flatbooleanfalseForces no shadow (still applies border for non-plain variants).
hoverbooleanfalseStronger shadow on hover (ignored if disabled or flat).
disabledbooleanfalseDisables pointer events and lowers opacity; root is not a link while disabled.
loadingbooleanfalseFull-card overlay and aria-busy.
imagestringTop media URL; overridden by slot #image.
titlestring | numberShorthand for a header line (overridden by #title).
subtitlestring | numberShorthand (overridden by #subtitle).
textstring | numberBody copy block (overridden by #text).
hrefstringRenders the root as <a> (unless disabled).
relstringFor anchors; if target="_blank", defaults to noopener noreferrer.
targetstringAnchor target.
downloadboolean | stringPassed to the anchor when href is set.
prependAvatarstringOptional header avatar URL (see #prepend).
appendAvatarstringOptional trailing avatar URL (see #append).
clickablebooleanfalseIf there is no href, the root is focusable with role="button" and keyboard Enter / Space (set only when the whole card is the control).
width / maxWidth / height / maxHeightstring | numberSize on the root (numbers are treated as px).
as'div' | 'article' | 'section''div'Root element when the card is not a link.
density'comfortable' | 'compact''comfortable'Slightly tighter padding.
roundedbooleantrueWhen false, corner radius is 0.

Additional attributes (for example aria-label, id, class) are forwarded to the root element, except class / style are merged with the component’s own.

GkCard — events

EventPayloadDescription
clickMouseEvent | KeyboardEventFor anchors, clickable cards, and any pointer/keyboard activation on the root.

GkCard — slots

SlotDescription
defaultMain content after the optional text block.
imageTop media; replaces image.
title / subtitle / textOverride the matching props.
itemExtra block inside the header row (below title/subtitle) when a header is shown.
prepend / appendHeader start/end regions (or use avatar props).
actionsFooter; wrap actions in GkCardActions for layout.
loaderReplaces the default GkSpinner in the loading overlay.

Subcomponents

ComponentRole
GkCardItemSingle header row: prepend, title stack, default + #item slot, append.
GkCardTitle / GkCardSubtitle / GkCardTextTypography blocks for custom layouts; GkCard uses them internally for convenience content. GkCardSubtitle / GkCardText support an opacity prop (CSS custom property on the node).
GkCardActionsEnd-aligned, wrapping row for GkButton (or other controls).

Tokens

TokenPurpose
--gk-card-radiusCorner radius.
--gk-card-shadow / --gk-card-shadow-hoverElevation.
--gk-card-border-widthBorder.
--gk-card-padding / --gk-card-padding-compactInner padding.
--gk-card-media-min-heightMin height of top media.
--gk-card-actions-min-height / --gk-card-actions-gapAction row.
--gk-card-loader-overlayScrim over the card when loading.

Try It

Use the playground to change common options, preview the result, and copy generated Vue code.

Editable GkCard

Generated code updates as you edit

Use this playground to learn the core props without a full SFC compiler.
vue
<script setup lang="ts">
import { GkCard } from 'god-kit/vue'
</script>

<template>
  <GkCard
    title="Editable GkCard"
    subtitle="Generated code updates as you edit"
    text="Use this playground to learn the core props without a full SFC compiler."
    hover
    :max-width="360"
  />
</template>

If the root is an <a> (href), do not place GkButton or other focusable elements that perform a second navigation inside the same card (use a clickable card with @click and route in script, or keep only text in the link card).

Accessibility

  • Loading sets aria-busy="true" on the root.
  • Clickable cards without href use role="button" and tabindex="0"; Enter and Space emit click. Prefer a real <a href> (or your router link as the root) for navigation so users get standard link behavior.
  • When the whole card is a single action, do not add separate primary buttons inside the same card unless you use a different pattern (e.g. the card is static and only the buttons act).
  • GkButton — primary actions inside GkCardActions
  • GkStack — spacing and alignment around cards
  • GkDataTablemobile layout uses a stacked “card” pattern

Released under the MIT License.