Skip to content

createGuideFlow()

Creates and returns a GuideFlowInstance — the main entry point for all GuideFlow functionality.

Signature

ts
function createGuideFlow(config?: GuideFlowConfig): GuideFlowInstance

GuideFlowConfig

OptionTypeDefaultDescription
rendererRendererContractDefaultRendererCustom step renderer
persistencePersistenceConfigundefinedProgress persistence settings
contextGuidanceContext{}Shared context passed to steps and guards
spotlightSpotlightOptions{}Spotlight overlay options
noncestringundefinedCSP nonce for injected <style> tags
injectStylesbooleantrueAuto-inject default CSS
debugbooleanfalseEnable debug logging

GuideFlowInstance

The returned instance provides:

Tour Methods

MethodDescription
start(flow)Start a tour from a flow definition
stop()Stop the current tour
next()Advance to the next step
prev()Go to the previous step
createFlow(def)Create a reusable flow definition

Hotspots & Hints

MethodDescription
hotspot(target, options)Add a pulsing beacon. Returns an ID.
removeHotspot(id)Remove a hotspot by ID
hints(items)Register hint badges
showHints()Show all registered hints
hideHints()Hide all hints

Events

MethodDescription
on(event, handler)Subscribe to an event. Returns unsubscribe function.
off(event, handler)Unsubscribe from an event

Other

PropertyDescription
i18nI18nRegistry instance
aiAI module (if @guideflow/ai is configured)

Example

ts
import { createGuideFlow } from '@guideflow/core'

const gf = createGuideFlow({
  spotlight: { padding: 10, animated: true },
  persistence: { driver: 'localStorage' },
  context: { userId: 'u1', roles: ['admin'] },
})

Released under the MIT License.