Skip to content

GhostCard ​

GhostCard is a composable surface with optional header, content, and footer parts. Use it for dashboard tiles, catalog items, and settings panels. The consumer owns layout inside each part; the primitive supplies stable hooks and optional ambient spotlight via useGhostInteractiveSurface.

Import it from @ghostvue/themes for default surface chrome. To style your own cards, see Advanced: headless composition.

Project summary cards ​

Project summary cards

Responsive two-card grid comparing an action card whose footer link and Deploy button act in place with a whole-card spotlight link.

NW
Northwind Web Production · us-west-2
Healthy
Latest build passed all 48 integration checks. Edge cache warming is active across 12 regions.
Deployment runbook Guide
Review rollback thresholds, canary weights, and regional drain steps before promoting a release. Read runbook →

Two themed GhostCard surfaces from @ghostvue/themes show the two card patterns side by side, in one column on narrow previews and two columns from 34rem (@container ghost-demo):

  • Northwind Web is a static article with its controls in #footer. View logs is a link to the deployment's logs and Deploy queues a deploy and reports it in a status line inside the card.
  • Deployment runbook is as="a" with href and interactive="spotlight". The whole card is one link and contains no other controls.

Parts render only when their slots have content. The default root is article.

Keep the root non-interactive when the card holds its own links or buttons, as the Northwind Web card does. Each footer control is its own tab stop, and the card announces as an article rather than as one large control. Report the result of an in-place action, such as the queued deploy, in a status line that stays mounted so the new text is announced.

Clickable (navigational) card ​

When as="a" with href, the entire card is one link, like the Deployment runbook card. Do not nest buttons or other links in header, content, or footer—that violates the interactive content model and fails accessibility checks. Secondary actions belong on a sibling surface or outside the link card.

Accessible patterns ​

  1. Navigate: as="a" + href on the root; slots contain only static markup.
  2. Act in place: default article / div root; put GhostButton or links in #footer or #content.
  3. Spotlight only: effects={['spotlight']} or themed interactive="spotlight" adds decoration; it does not make the card focusable.

Ambient spotlight ​

Themed card

Elevation chrome and optional spotlight from themes.

Themed card

Default elevation and padding from @ghostvue/themes.
Footer slot

Themed interactive="spotlight" tracks the pointer across the card. Pointer tracking uses data-interactive-state so a future data-state on the card is reserved for consumer semantics.

Themed props ​

@ghostvue/themes adds these to the headless GhostCard API, which it forwards:

PropTypeDefaultDescription
interactive'spotlight'nullOpt-in ambient spotlight on the card.

The themed wrapper sets data-themed on the inner root.

Accessibility ​

  • Prefer native article, a, or button over invented roles.
  • Never nest interactive elements inside an a or button card root.
  • The spotlight glow is aria-hidden; reduced motion disables tracking.

See the specification for the full contract.

Advanced: headless composition ​

For teams that bring their own design system, the headless GhostCard from @ghostvue/vue renders the same parts and roots with no surface chrome.

Basic use ​

Card basics Headless

Header, content, and footer parts on a surface.

Quarterly report

Revenue grew 12% compared to the previous quarter.
Updated 2h ago
Card with actions Headless

Static root and footer buttons.

Notifications

You have no unread notifications.

Headless navigational card ​

Navigational card Headless

Whole-card link without nested interactives.

Headless spotlight ​

Spotlight card Headless

Ambient pointer tracking on the card root.

Spotlight

Move the pointer to preview ambient tracking on this surface.

Composable ​

useGhostCard returns as, rootProps, and isActionRoot for custom hosts. The GhostCard reference page renders the card/composable example with its source.

API ​

PropTypeDefaultDescription
asGhostCardElement"article"Root element. Use a only when the whole card navigates without nested controls.
effects'spotlight'[]"[]"Ambient spotlight recipes. Empty list keeps the card inert.
SlotSlot propsDescription
default—Primary body; rendered in data-part="content".
footer—Optional bottom region for actions on static roots.
header—Optional top region.

Native attributes fall through to the root. The component sets class, data-ghost-card, data-part="root", and spotlight hooks when enabled.

The root exposes element: HTMLElement | null through a template ref.