Skip to content

GuidedTour

Purpose

GuidedTour provides an interactive walkthrough experience:

  • Spotlight highlighting of target elements
  • Step-by-step navigation
  • Keyboard navigation support
  • Positioned tooltips with arrows

When to use

Use GuidedTour for:

  • New user onboarding
  • Feature discovery
  • Complex workflow guidance
  • First-time setup wizards

Basic usage

tsx
import { GuidedTour, type TourStep } from '@/shared/ui/components/GuidedTour'

const steps: TourStep[] = [
  {
    target: '#sidebar-nav',
    title: 'Navigation',
    content: 'Use the sidebar to navigate between sections.',
    position: 'right',
  },
  {
    target: '#create-button',
    title: 'Create New',
    content: 'Click here to create a new item.',
    position: 'bottom',
  },
  {
    target: '#search-input',
    title: 'Search',
    content: 'Use search to find items quickly.',
    position: 'bottom',
  },
]

export function OnboardingTour() {
  const [isOpen, setIsOpen] = useState(true)

  return (
    <GuidedTour
      steps={steps}
      isOpen={isOpen}
      onClose={() => setIsOpen(false)}
      onFinish={() => {
        setIsOpen(false)
        // Mark onboarding complete
      }}
    />
  )
}

Props

GuidedTourProps

PropTypeRequiredDescription
stepsTourStep[]YesArray of tour steps
isOpenbooleanYesWhether tour is active
onClose() => voidYesCalled when tour is dismissed
onFinish() => voidYesCalled when tour completes
classNamestringNoAdditional class

TourStep

PropertyTypeRequiredDescription
targetstringYesCSS selector for target element
titlestringYesStep title
contentReactNodeYesStep description
position'top' | 'right' | 'bottom' | 'left'NoTooltip position

Keyboard navigation

KeyAction
EscapeClose tour
Enter / Next step
Previous step

Notes

  • Target elements must exist in the DOM when the tour starts
  • The spotlight uses a neon glow effect for visibility
  • Tour progress is shown as "X / Y" in the tooltip
  • Consider persisting completion state to avoid showing repeatedly