Skip to content

๐Ÿงญ ModernTour Component (v2+) โ€‹

The ModernTour component provides interactive product tours and onboarding guidance in your Vue 2 app โ€” complete with animations, progress tracking, route awareness, and persistent state.

It is designed for use inside the Gull Theme and supports both single-page and multi-route flows.


๐Ÿš€ Features โ€‹

โœ… Smooth highlight and card animations
โœ… Auto-progress and manual navigation
โœ… Persistent progress (via localStorage or TourManager)
โœ… Works across multiple routes
โœ… Finish overlay with confetti animation
โœ… Skip, Resume, and Reset options
โœ… Keyboard navigation (โ†, โ†’, Esc)
โœ… Router-aware steps (route key)
โœ… Easy integration with a global TourManager


๐Ÿ“ฆ Installation โ€‹

bash
# using npm
npm install --save modern-tour

# or via yarn
yarn add modern-tour

๐Ÿงฉ Basic Usage โ€‹

Define your tour steps in a Vue component:

vuejs
<script>
export default {
  data() {
    return {
      tourSteps: [
        {
          target: '#user-info-tour',
          title: 'Student Information',
          content:
            'Here you can view the studentโ€™s basic information โ€” including name, class, and contact details.',
          placement: 'auto',
        },
        {
          target: '#fees-details-tour',
          title: 'Fees Details',
          content:
            'This section shows all fee records, including payment history and pending amounts.',
          placement: 'auto',
        },
        {
          target: '#view-all-receipt',
          title: 'View All Receipts',
          content:
            'Click here to see all receipts related to the studentโ€™s payments.',
          placement: 'auto',
        },
        {
          target: '#settings',
          title: 'Settings',
          content:
            'This shortcut takes you to the settings section to customize your preferences.',
          route: { name: 'FeesSetting' },
          placement: 'auto',
        },
      ],
    }
  },
}
</script>

<template>
  <ModernTour
    :steps="tourSteps"
    tour-id="student-fees-tour"
    :auto-start="true"
    :finish-behavior="'stop'"
  />
</template>

โš™๏ธ Props โ€‹

PropTypeDefaultDescription
tourIdStringrequiredUnique ID for persisting state
stepsArrayrequiredList of steps (see below)
autoStartBooleanfalseAutomatically start the tour after mount
autoStartDelayNumber600Delay before auto-start (ms)
scrollIntoViewBooleantrueScrolls to target element before showing
finishBehaviorString'stop'What to do after finish (stop, redirect, restart)
finishRedirectRouteObject/StringnullVue Router destination on finish
finishSoundBooleanfalsePlay small completion sound
reopenAfterFinishBooleanfalseAutomatically restart after finishing
padNumber12Padding around highlight target
spotShapeString'rect'Shape of highlight (rect, circle, auto)
finishMessageStringCongratulations โ€” tour finished!Custom completion message

๐Ÿง  Step Object โ€‹

Each step in the steps array supports the following keys:

KeyTypeDescription
targetString (CSS selector)Element to highlight
titleStringTitle shown in the card
contentString (HTML allowed)Description text
placementString'auto', 'top', 'bottom', 'left', 'right'
routeObject/StringOptional Vue Router destination
shapeString'rect' or 'circle' (if override needed)

๐ŸŽฎ Navigation โ€‹

ButtonAction
NextMove to next step
PrevGo to previous step
SkipSkip all remaining steps and mark finished
StepsOpen step list modal (jump to step)
FinishComplete the tour and trigger animation

Keyboard shortcuts: โ€‹

  • โ†’ : Next step
  • โ† : Previous step
  • Esc : Close tour

๐Ÿ’พ Persistence โ€‹

Each tourโ€™s progress is stored in localStorage:

arduino
tour:<tourId>:completed // Array of completed step indices
tour:<tourId>:done // "1" if tour completed

You can reset progress manually:

js
localStorage.removeItem('tour:student-fees-tour:completed')
localStorage.removeItem('tour:student-fees-tour:done')