Spotlight / Feature Discovery

Guide users through your interface with step-by-step tours. An overlay highlights target elements while a tooltip provides context and navigation controls. Add a JSON array of steps to any trigger via data-vd-spotlight and it starts on click.

Interactive Tour

Click the button below to start a 3-step feature discovery tour that highlights the elements in this card.

Notifications

Profile Menu

<button class="vd-btn vd-btn-primary" data-vd-spotlight='[
  {"target":"#search","title":"Quick Search","description":"Find anything instantly."},
  {"target":"#bell","title":"Notifications","description":"Mentions and updates."},
  {"target":"#me","title":"Your Profile","description":"Account and theme settings."}
]'>
  Start Tour
</button>

<!-- Targets referenced by the steps above -->
<div id="search"></div>
<div id="bell"></div>
<div id="me"></div>
Engine wiring
import { ref } from 'vue';
import { useSpotlight } from "@vanduo-oss/vd3";

const root = ref<HTMLElement | null>(null);
useSpotlight(root);   // wires every [data-vd-spotlight] inside root
API Reference

CSS Classes

ClassDescription
.vd-spotlight-overlayFull-screen dimmer with a cut-out around the target.
.vd-spotlight-tooltipFloating step tooltip positioned beside the target.
.vd-spotlight-titleTooltip heading (the step's title).
.vd-spotlight-descriptionTooltip body copy (the step's description).
.vd-spotlight-counter“2 / 3” progress indicator.
.vd-spotlight-footerFooter row holding the navigation buttons.
.vd-spotlight-btnSecondary navigation button (Back / Skip).
.vd-spotlight-btn-primaryPrimary navigation button (Next / Done).
.vd-spotlight-targetClass applied to the highlighted element while active.

Data Attributes

AttributeDescription
data-vd-spotlightJSON array of steps on the trigger. Each step: { target, title, description }.

JavaScript Methods

MethodDescription
useSpotlight(root)Wire every [data-vd-spotlight] trigger within root; returns a controller. Call once in setup().
controller.start(steps, opts?)Start a tour from an array of step objects.
controller.stop()End the active tour and remove the overlay.
Accessibility
  • The overlay traps focus on the active step's controls; Tab cycles Back / Skip / Next.
  • Escape ends the tour; / step between targets.
  • The highlighted target is scrolled into view and announced via the tooltip's role="dialog".