Liking cljdoc? Tell your friends :D

x-welcome-tour

A guided product tour component with spotlight backdrop, popover steps, and configurable connectors. Each step highlights a target element on the page with a dimmed overlay and cutout, anchoring a popover with navigation controls.

Tag name: x-welcome-tour Step tag name: x-welcome-tour-step


Usage

<x-welcome-tour id="tour" counter>
  <x-welcome-tour-step target="#search-box" title="Search" placement="bottom">
    <p>Find anything fast with the search bar.</p>
  </x-welcome-tour-step>
  <x-welcome-tour-step target="#sidebar" title="Navigation" placement="right">
    <p>Browse all sections from the sidebar.</p>
  </x-welcome-tour-step>
</x-welcome-tour>

<script>
  document.getElementById('tour').start();
</script>

x-welcome-tour Attributes

AttributeTypeDefaultDescription
openboolean (presence)absentWhether the tour is active
stepstring (number)"0"Current step index (0-based)
connectorenum"arrow"Default connector: arrow, line, curve, none
prev-labelstring"Back"Previous button text
next-labelstring"Next"Next button text
done-labelstring"Done"Last-step button text
skip-labelstring"Skip"Close/skip button text
counterboolean (presence)absentShow step counter "N / M"
dotsboolean (presence)absentShow dot indicators

x-welcome-tour Properties

PropertyTypeReflectsDescription
openbooleanopenTour active state
stepnumberstepCurrent step index
connectorstringconnectorDefault connector type
totalStepsnumber(readonly)Number of step child elements
prevLabelstringprev-labelPrevious button text
nextLabelstringnext-labelNext button text
doneLabelstringdone-labelDone button text
skipLabelstringskip-labelSkip button text

x-welcome-tour Methods

MethodSignatureDescription
start()() => voidOpen tour at step 0
next()() => voidAdvance to next step (or complete)
prev()() => voidGo to previous step
goTo(n)(number) => voidJump to step n
complete()() => voidClose tour, dispatch complete event
skip()() => voidClose tour, dispatch skip event

x-welcome-tour Events

EventCancelableDetail
x-welcome-tour-startfalse{}
x-welcome-tour-step-changetrue{ step: number, previousStep: number }
x-welcome-tour-completefalse{ stepsCompleted: number }
x-welcome-tour-skipfalse{ step: number }

All events bubble and are composed.

Cancelling x-welcome-tour-step-change (via preventDefault()) prevents the step from advancing.

x-welcome-tour Slots

SlotDescription
(default)x-welcome-tour-step children

x-welcome-tour-step Attributes

AttributeTypeDefaultDescription
targetstring (selector)(required)CSS selector for the target element
titlestring""Step title displayed in the popover header
placementenum"bottom"Popover placement relative to target
connectorenum(inherit)Override connector for this step
cutout-paddingstring (number)"8"Extra padding around the target cutout (px)
cutout-radiusstring (number)"4"Border radius of the cutout (px)
scroll-tobooleantrueScroll target into view when step activates

Placement values

top, bottom, left, right, top-start, top-end, bottom-start, bottom-end

Connector values

arrow (CSS triangle), line (straight SVG), curve (S-shaped SVG bezier), none

x-welcome-tour-step Properties

PropertyTypeReflects
targetstringtarget
titlestringtitle
placementstringplacement
connectorstringconnector
cutoutPaddingnumbercutout-padding
cutoutRadiusnumbercutout-radius
scrollTobooleanscroll-to

x-welcome-tour-step Slots

SlotDescription
(default)Rich content for the step popover body

CSS Custom Properties

Set these on x-welcome-tour or an ancestor to customise appearance.

PropertyDefault
--x-welcome-tour-backdroprgba(0,0,0,0.5)
--x-welcome-tour-backdrop-zvar(--x-z-modal, 1100)
--x-welcome-tour-glow-colorrgba(255,255,255,0.15)
--x-welcome-tour-glow-blur8px
--x-welcome-tour-popover-bgvar(--x-color-bg, #ffffff)
--x-welcome-tour-popover-fgvar(--x-color-text, #0f172a)
--x-welcome-tour-popover-border1px solid var(--x-color-border, #e2e8f0)
--x-welcome-tour-popover-radiusvar(--x-radius-lg, 12px)
--x-welcome-tour-popover-shadowvar(--x-shadow-lg)
--x-welcome-tour-popover-widthmin(360px, calc(100vw - 2rem))
--x-welcome-tour-transition-durationvar(--x-transition-duration, 300ms)
--x-welcome-tour-transition-easingvar(--x-transition-easing, ease)
--x-welcome-tour-connector-colorvar(--x-color-primary, #3b82f6)
--x-welcome-tour-connector-width2px
--x-welcome-tour-dot-colorvar(--x-color-border, #e2e8f0)
--x-welcome-tour-dot-activevar(--x-color-primary, #3b82f6)
--x-welcome-tour-button-bgvar(--x-color-primary, #3b82f6)
--x-welcome-tour-button-fg#ffffff

CSS Parts

Style shadow DOM elements using ::part():

PartElement
backdrop-svgSVG overlay with cutout mask
popoverPopover card container
headerPopover header row
titleStep title text
counterStep counter "N / M"
close-buttonClose/skip button (x)
bodyStep content area
footerNavigation footer
prev-buttonBack button
next-buttonNext/Done button
dotsDot indicators container
dotIndividual dot indicator
arrowCSS arrow triangle
connector-svgSVG connector (line/curve)

Accessibility

  • The popover has role="dialog"
  • Focus is trapped within the popover while the tour is open
  • Escape skips (closes) the tour
  • ArrowRight / ArrowDown advances to the next step
  • ArrowLeft / ArrowUp goes to the previous step
  • On close, focus is restored to the element that was focused before the tour opened
  • All buttons meet 44px minimum touch target on coarse pointers
  • Animations respect prefers-reduced-motion: reduce

Theming

The component consumes x-theme design tokens. All CSS custom properties use var(--x-token, fallback) so the component works with or without an <x-theme> ancestor.

Light/dark mode is handled via @media (prefers-color-scheme: dark) inside the overlay layer styles.

Mobile

  • Popover width: min(360px, calc(100vw - 2rem)) prevents overflow on small screens
  • Touch targets are 44px minimum on coarse pointers
  • Scroll-to-view ensures targets are visible before highlighting
  • Positioning flips automatically when there isn't enough room

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close