Skip to content

Spotlights

Spotlights are single-element highlights that draw attention to a specific part of the page. Unlike tours (which are multi-step), a spotlight focuses on one element with a darkened backdrop overlay that dims the rest of the page, making the target element visually prominent.

Overview

A spotlight consists of:

  • Backdrop overlay -- Dims the entire page except the target element
  • Highlighted element -- The target element "pops" through the overlay, appearing brighter and more prominent
  • Callout -- A tooltip-style card positioned next to the highlighted element with a title, body, and optional CTA

Spotlights are ideal for:

  • Drawing attention to a new feature or button
  • Highlighting a changed UI element after a product update
  • Focusing the user on a specific action they need to take
  • Announcing a promotion or offer attached to a specific element

Creating a Spotlight

Via the Admin Panel

  1. Navigate to Content > Spotlights and click Create Spotlight.
  2. Click on the target element using the visual element selector.
  3. Write the callout title and body content.
  4. Configure trigger, audience, and scheduling rules.
  5. Click Publish.

Via the API

All non-tour content shares one admin endpoint — POST /v1/admin/content — discriminated by content_type.

bash
POST /v1/admin/content
Content-Type: application/json
X-Api-Key: sk_live_...

{
  "content_type": "spotlight",
  "name": "New Export Button",
  "selector": "[data-spotlight='export-btn']",
  "position": "bottom",
  "title": "New: Export to PDF",
  "body": "<p>You can now export your reports as PDF files. Click here to try it.</p>",
  "cta": { "text": "Try It", "action": "click_target" },
  "dismiss_text": "Got It",
  "trigger": { "trigger_type": "first_visit" },
  "audience": {
    "rules": [
      { "attribute": "plan", "operator": "in", "values": ["pro", "enterprise"] }
    ]
  }
}

Configuration

FieldTypeRequiredDescription
namestringYesInternal name for the spotlight (not shown to users)
selectorstringYesCSS selector targeting the DOM element to highlight
positionstringNoCallout position relative to the target: top, bottom, left, right, auto (default: auto)
titlestringYesCallout heading text
bodystringNoCallout body content (supports safe HTML)
ctaobjectNoCall-to-action button configuration
dismiss_textstringNoText for the dismiss button (default: "Got It")
mediaobjectNoEmbedded image or video in the callout
backdrop_click_dismissesbooleanNoWhether clicking the backdrop overlay dismisses the spotlight (default: true)
triggerobjectNoWhen to show the spotlight
audienceobjectNoWho should see the spotlight

Backdrop Overlay

The backdrop overlay covers the entire viewport with a semi-transparent dark layer. The target element is "cut out" of the overlay, appearing at full brightness.

The overlay colour is controlled by the --spot-overlay-bg theme variable:

js
Spotlight.init({
  apiKey: 'spot_live_abc123',
  theme: {
    '--spot-overlay-bg': 'rgba(0, 0, 0, 0.6)',
  },
});

By default, clicking anywhere on the backdrop dismisses the spotlight. Set backdrop_click_dismisses: false to require the user to click the dismiss button or CTA.

TIP

The backdrop overlay is rendered inside the Shadow DOM and does not affect your page's scroll position or interact with your page's event listeners. The target element remains fully interactive -- the user can click it, hover over it, and tab to it normally.

Callout Positioning

The callout card is positioned using @floating-ui/dom with automatic overflow detection. If the preferred position would cause the callout to extend beyond the viewport, it flips to the opposite side or shifts along the axis to fit.

json
{
  "position": "right"
}
PositionBehaviour
topAbove the target element
bottomBelow the target element
leftTo the left of the target element
rightTo the right of the target element
autoBest fit based on available viewport space (default)

CTA Actions

The optional call-to-action button supports the same action types as tour steps:

ActionDescription
dismissClose the spotlight (default)
click_targetSimulate a click on the highlighted element, then dismiss
urlNavigate to a URL
json
{
  "cta": {
    "text": "Try It Now",
    "action": "click_target"
  }
}

Missing Target Behaviour

If the target element is not found:

  1. The spotlight does not render. No backdrop, no callout, no error.
  2. A targeting.element_not_found event is sent to the backend.
  3. The SDK retries on subsequent DOM mutations (the element may appear later in SPA navigation).
  4. After 3 retries, a targeting.permanently_missing event is sent and the spotlight is abandoned for this page load.

Programmatic Control

Spotlights fire on the trigger + audience rules attached in the admin panel. Hook content:dismiss to react when one closes:

js
Spotlight.on('content:dismiss', (data) => {
  console.log(`User dismissed content: ${data.contentId}`);
});

Spotlights vs Tours

FeatureSpotlightTour
Elements highlighted1Multiple (sequential)
Backdrop overlayYesOptional per step
Progress indicatorNoYes
Navigation controlsDismiss onlyNext, Previous, Skip
User progress trackedViewed/dismissedPer-step completion

Use a spotlight when you want to draw attention to a single element. Use a tour when you need to walk the user through a sequence of elements.

Spotlight