Skip to content

GhostInteractiveSurface ​

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.

Feature tiles ​

Feature tiles

Responsive grid of themed spotlight tiles, each with a focusable link as its action.

Pointer trackingAmbient
Updates --ghost-pointer-x and --ghost-pointer-y smoothly on pointer move.Read the styling hooks
Reduced motionAccessible
Disables spotlight tracking automatically when prefers-reduced-motion is active.Review accessibility behavior

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.

Spotlight a single card ​

Basic

Pointer spotlight on a content surface.

Quarterly report The glow follows the pointer. Copy stays readable without it.

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 opt-in ​

Themed GhostButton stays inert unless you pass interactive="spotlight". Off by default — existing screenshots do not change.

Button opt-in

Themed GhostButton stays inert until interactive is set.

That sets data-interactive="spotlight" and tracks on data-interactive-state so loading and disabled keep data-state.

Theme knob ​

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.

Accessibility and environment behavior ​

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.

Advanced: headless composition ​

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.

Composable ​

Composable Headless

Spotlight tracking on a native host with a glow layer.

Quarterly report

Move the pointer across this card.

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.

Styling ​

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.

API ​

See the generated component references for props, emits, slots, exposed members, styling hooks, CSS variables, and executable examples.

PropTypeDefaultDescription
asInteractiveSurfaceElement"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.
SlotSlot propsDescription
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.