Props for the <SpotlightProvider> component that wraps your application and manages all tour state.
Prop
Type
Default
Description
children
ReactNode
--
Your application content
theme
'light' | 'dark' | 'auto' | SpotlightTheme
'light'
Theme preset or custom theme object
overlayColor
string
'rgba(0, 0, 0, 0.5)'
Overlay background color (with alpha)
transitionDuration
number
300
Transition duration in milliseconds
escToDismiss
boolean
true
Whether pressing Escape dismisses the tour
overlayClickToDismiss
boolean
true
Whether clicking the overlay dismisses the tour
showProgress
boolean
true
Whether to show a progress bar
showSkip
boolean
true
Whether to show a skip button
labels
SpotlightLabels
--
Custom labels for i18n
onComplete
(tourId: string) => void
--
Called when any tour completes
onSkip
(tourId: string, stepIndex: number) => void
--
Called when any tour is skipped
onStateChange
(tourId: string, state: TourState) => void
--
Called with tour state for persistence
initialState
Record<string, TourState>
--
Initial state for restoring persisted tours
waitForElementTimeout
number
5000
Default max time (ms) to wait for a step's target to appear in the DOM before skipping to the next step. Overridable per-step via SpotlightStep.timeout
persist
boolean | SpotlightStorage
--
Enable cross-navigation persistence. true uses localStorage; pass a custom SpotlightStorage for other backends. Off by default
persistKey
string
'react-tourlight'
Storage key used when persist is enabled
persistMaxAge
number
--
Discard persisted state older than this many ms (staleness guard)
resume
boolean
true
Auto-resume a persisted, still-active tour on mount
navigate
(path: string) => void
--
Called with a step's route when it doesn't match the current location. Plug in your router
Condition -- step is skipped if this returns false
onBeforeShow
() => void | Promise<void>
--
Called before the step is shown (can be async)
onAfterShow
() => void
--
Called after the step is visible
onHide
() => void
--
Called when the step is hidden
disableOverlayClose
boolean
false
Prevent overlay click from dismissing
interactive
boolean
false
Make the spotlight hole genuinely transparent to all pointer/keyboard/focus events, so the user can interact with the real highlighted element (typing, hovering, dragging, scrolling)
advanceOn
{ event: string; selector?: string }
--
Auto-advance the tour when event fires on the target (or a descendant matching selector). Implies interactive
route
string
--
The path this step lives on. When advancing to it on a different route, the provider calls navigate(route) and waits for the target there. Supports exact, :param, and trailing *
onBeforeStep
() => void | Promise<void>
--
Escape hatch run before the step's target is resolved (and before route navigation). Awaited
timeout
number
5000
Max time (ms) to wait for target to appear in the DOM before skipping this step. Overrides waitForElementTimeout on the provider
The react-tourlight/core subpath exports the entire unstyled engine with no
CSS, no default tooltip, and no Floating UI. See the Headless
Core guide. Key exports:
All of the engine primitives below (plus useTour, isRouteActive,
getCurrentPath, and createMemoryStorage) are also re-exported from the main
react-tourlight entry for convenience.
Advanced/low-level exports for building a fully custom tour UI. Most
consumers won't need these directly — SpotlightProvider and
SpotlightTour use them internally.
Closure-based state machine driving step/lifecycle transitions (start, stop, next, previous, skip, goToStep, getState, subscribe). No UI or DOM access.
Waits for a CSS selector to match an element in the DOM via MutationObserver. Resolves with the element, or null after options.timeout (default 5000ms) elapses.