Quarterly report
Move the pointer across this card.
Pointer spotlight for surfaces that should notice the cursor. Import the themed GhostInteractiveSurface from @ghostvue/themes. v1 is spotlight only; tilt and magnetic are follow-ups. See ADR 0009. To track the pointer on markup you style yourself, see Advanced: headless composition.
Responsive grid of themed spotlight tiles, each with a focusable link as its action.
<script setup lang="ts">
import {
GhostBadge,
GhostInteractiveSurface,
GhostLink,
} from '@ghostvue/themes'
const capabilities = [
{
title: 'Pointer tracking',
tag: 'Ambient',
description:
'Updates --ghost-pointer-x and --ghost-pointer-y smoothly on pointer move.',
action: 'Read the styling hooks',
href: '/components/interactive-surface#styling',
},
{
title: 'Reduced motion',
tag: 'Accessible',
description:
'Disables spotlight tracking automatically when prefers-reduced-motion is active.',
action: 'Review accessibility behavior',
href: '/components/interactive-surface#accessibility-and-environment-behavior',
},
] as const
</script>
<template>
<div class="surface-showcase">
<GhostInteractiveSurface
v-for="item in capabilities"
:key="item.title"
class="surface-showcase__tile"
>
<div class="surface-showcase__header">
<span class="surface-showcase__title">{{ item.title }}</span>
<GhostBadge tone="neutral" variant="soft" size="sm">
{{ item.tag }}
</GhostBadge>
</div>
<span class="surface-showcase__copy">{{ item.description }}</span>
<!--
The surface is decoration and never takes focus. The tile's action is
a real link inside it, so keyboard users reach it and see its focus ring.
-->
<span class="surface-showcase__action">
<GhostLink :href="item.href">{{ item.action }}</GhostLink>
</span>
</GhostInteractiveSurface>
</div>
</template>
<style scoped>
.surface-showcase {
display: grid;
gap: var(--ghost-space-stack-md);
}
.surface-showcase__header {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
}
.surface-showcase__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-md);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-snug);
}
.surface-showcase__action {
align-self: end;
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-normal);
}
.surface-showcase__copy {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-normal);
}
@container ghost-demo (min-width: 30rem) {
.surface-showcase {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
</style>
<!--
Unscoped on purpose: the themed surface forwards `class` to its inner
element, which does not carry this file's scoped attribute.
-->
<style>
.surface-showcase__tile {
background-color: var(--ghost-elevation-1-bg, Canvas);
border: var(--ghost-border-hairline-width, 1px) solid
var(--ghost-elevation-1-border, CanvasText);
border-radius: var(--ghost-radius-md, 0.5rem);
box-sizing: border-box;
display: grid;
gap: var(--ghost-space-gap-xs);
/* Header and copy stay together; the action sits at the bottom edge. */
grid-template-rows: auto auto 1fr;
min-block-size: 7rem;
padding: var(--ghost-space-inset-md);
}
</style>
Two themed GhostInteractiveSurface tiles from @ghostvue/themes sit in a @container ghost-demo grid that becomes two columns when the preview is wide enough. Move the pointer across a tile and a soft glow follows it.
The glow is decoration, so the surface itself never takes focus or handles clicks. Each tile's action is a themed GhostLink inside it: Tab reaches the link, its focus ring shows, and Enter follows it to the matching section of this guide. Put buttons or links inside a surface rather than making the surface clickable.
Pointer spotlight on a content surface.
<script setup lang="ts">
import { GhostInteractiveSurface } from '@ghostvue/themes'
</script>
<template>
<div class="surface-basic-example">
<GhostInteractiveSurface class="surface-basic-example__card">
<span class="report-card__title">Quarterly report</span>
<span class="report-card__copy">
The glow follows the pointer. Copy stays readable without it.
</span>
</GhostInteractiveSurface>
</div>
</template>
<style scoped>
.surface-basic-example {
display: grid;
}
.report-card__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-md);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-snug);
}
.report-card__copy {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-normal);
}
</style>
<!--
Unscoped on purpose: the themed surface forwards `class` to its inner
element, which does not carry this file's scoped attribute.
-->
<style>
.surface-basic-example__card {
align-content: start;
background-color: var(--ghost-elevation-1-bg, Canvas);
border: var(--ghost-border-hairline-width, 1px) solid
var(--ghost-elevation-1-border, CanvasText);
border-radius: var(--ghost-radius-md, 0.5rem);
box-sizing: border-box;
display: grid;
gap: var(--ghost-space-gap-xs);
min-block-size: 8rem;
padding: var(--ghost-space-inset-md);
}
</style>
Wrap any content block in GhostInteractiveSurface. Pass as (div, article, section, or aside) for the element that is valid in the parent context. Pass :effects="[]" to turn the glow off for one instance without removing the wrapper. Copy stays readable when the glow is off.
Themed GhostButton stays inert unless you pass interactive="spotlight". Off by default — existing screenshots do not change.
Themed GhostButton stays inert until interactive is set.
<script setup lang="ts">
import { GhostButton } from '@ghostvue/themes'
</script>
<template>
<GhostButton interactive="spotlight">Save changes</GhostButton>
</template>
That sets data-interactive="spotlight" and tracks on data-interactive-state so loading and disabled keep data-state.
defineTheme({ interactivity: 'none' | 'subtle' | 'expressive' }) maps onto interactive.spotlight.size and interactive.spotlight.opacity. The authored default is subtle (10rem / 0.28). none zeros the glow. expressive enlarges it (20rem / 0.75). Flagships: calm and mono use subtle (mono’s chroma-0 primary is the hairline color); vibrant uses expressive.
Spotlight is decoration. Reduced motion and coarse pointers are fully off. SSR markup is data-state="off"; capable surfaces become idle after mount. Setup does not read browser globals.
See the approved specification.
For teams that bring their own design system, GhostInteractiveSurface from @ghostvue/vue tracks the pointer with no surface styling, and useGhostInteractiveSurface adds the same tracking to an element you render.
Spotlight tracking on a native host with a glow layer.
Quarterly report
Move the pointer across this card.
<script setup lang="ts">
import { useTemplateRef } from 'vue'
import { useGhostInteractiveSurface } from '@ghostvue/vue'
const host = useTemplateRef<HTMLElement>('host')
const { rootProps } = useGhostInteractiveSurface(host)
</script>
<template>
<article ref="host" class="report-card" v-bind="rootProps">
<span data-part="glow" aria-hidden="true" />
<p class="report-card__title">Quarterly report</p>
<p class="report-card__copy">Move the pointer across this card.</p>
</article>
</template>
<style scoped>
.report-card {
min-block-size: 8rem;
padding: var(--ghost-space-inset-md, 1.25rem);
position: relative;
}
.report-card__title,
.report-card__copy {
margin: 0;
}
.report-card__title {
font-size: 1.15rem;
font-weight: 650;
}
</style>
useGhostInteractiveSurface(target, options?) also accepts stateAttribute ('data-state' or 'data-interactive-state') for hosts that already own data-state. It writes --ghost-pointer-x / --ghost-pointer-y (px) and unitless --ghost-pointer-nx / --ghost-pointer-ny on the host. Render the data-part="glow" element yourself, as a direct child of the host.
Recipes key off data-interactive~='spotlight' and data-part="glow". Peak opacity is calc(var(--ghost-interactive-spotlight-opacity) * var(--ghost-motion-intensity, 1)). Leave settles with --ghost-interactive-leave-spring. Forced colors and prefers-reduced-motion: reduce drop the glow. Coarse pointers never track.
One active tracking surface is the expected case. The library does not enforce a singleton.
See the generated component references for props, emits, slots, exposed members, styling hooks, CSS variables, and executable examples.
| Prop | Type | Default | Description |
|---|---|---|---|
as | InteractiveSurfaceElement | "div" | Rendered root element. Choose the tag that is valid in the parent context. |
effects | 'spotlight'[] | "[\"spotlight\"]" | Recipes advertised on data-interactive. v1 supports spotlight only. An empty list is an explicit off. |
| Slot | Slot props | Description |
|---|---|---|
default | — | Surface content. The glow layer is rendered by the component, not this slot. |
@ghostvue/themes adds no props, events, or slots to the headless GhostInteractiveSurface API, which it forwards.
InteractiveEffect is 'spotlight'. Native attributes fall through to the root. The default slot is the content. A template ref exposes element.