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.
Search Bar
Notifications
Profile Menu
Engine wiring
API Reference
CSS Classes
| Class | Description |
|---|---|
.vd-spotlight-overlay | Full-screen click catcher; dimming comes from the highlight cutout. |
.vd-spotlight-highlight | Body-level cutout positioned over the active target (box-shadow dimmer). |
.vd-spotlight-tooltip | Floating step tooltip positioned beside the target. |
.vd-spotlight-title | Tooltip heading (the step's title). |
.vd-spotlight-description | Tooltip body copy (the step's description). |
.vd-spotlight-counter | “2 / 3” progress indicator. |
.vd-spotlight-footer | Footer row holding the navigation buttons. |
.vd-spotlight-btn | Secondary navigation button (Back / Skip). |
.vd-spotlight-btn-primary | Primary navigation button (Next / Done). |
.vd-spotlight-target | Class applied to the highlighted element while active. |
Data Attributes
| Attribute | Description |
|---|---|
data-vd-spotlight | JSON array of steps on the trigger. Each step: { target, title, description }. |
JavaScript Methods
| Method | Description |
|---|---|
useSpotlight(root, options?) | Wire every [data-vd-spotlight] trigger within root; returns a SpotlightApi controller. Call once in setup(). |
UseSpotlightOptions | { tooltipGap?: number (12), viewportMargin?: number (8), settleFrames?: number (30), labels?: { back?, skip?, next?, done? } }. |
controller.start(steps, opts?) | Start a tour from an array of SpotlightStep objects ({ target, title?, description?, content? }). Optional { trigger } restores focus on stop. |
controller.stop() | End the active tour, remove the overlay/cutout, and restore focus to the trigger. |
controller.next() / controller.prev() | Advance to the next step or return to the previous step of the active tour. |
controller.refresh() | Re-scan root and wire [data-vd-spotlight] triggers added after mount. |
spotlight:step | CustomEvent<{ index, step, total, data }> dispatched on document whenever a step is shown. |
spotlight:end | CustomEvent<{ completedSteps, total, completed }> dispatched on document when the tour ends. |
Accessibility
- The step tooltip renders with
role="dialog",aria-modal="true", and wires the step title and description viaaria-labelledbyandaria-describedby. - Pressing Escape (or clicking the overlay / Skip / Done buttons) closes the tour and restores focus to the trigger element that launched it.
- The active target receives
.vd-spotlight-targetand is scrolled smoothly into view while the body-level cutout (aria-hidden="true") tracks its bounding box.