Skip to content

Getting Started

Installation

bash
npm install v-onboarding
bash
yarn add v-onboarding
bash
pnpm add v-onboarding

Basic Setup

1. Import the component and styles

ts
import { VOnboardingWrapper, useVOnboarding } from 'v-onboarding'
import 'v-onboarding/dist/style.css'

2. Define your steps

ts
const steps = [
  {
    attachTo: { element: '#step-1' },
    content: {
      title: 'Welcome!',
      description: 'Let us show you around.'
    }
  },
  {
    attachTo: { element: '#step-2' },
    content: {
      title: 'Features',
      description: 'Here are the key features.'
    }
  }
]

3. Set up the wrapper and composable

vue
<template>
  <VOnboardingWrapper ref="wrapper" :steps="steps" />

  <!-- Your app content -->
  <button id="step-1">First Element</button>
  <div id="step-2">Second Element</div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { VOnboardingWrapper, useVOnboarding } from 'v-onboarding'
import 'v-onboarding/dist/style.css'

const wrapper = ref(null)
const { start, finish, goToStep } = useVOnboarding(wrapper)

const steps = [
  {
    attachTo: { element: '#step-1' },
    content: { title: 'Welcome!', description: 'Let us show you around.' }
  },
  {
    attachTo: { element: '#step-2' },
    content: { title: 'Features', description: 'Here are the key features.' }
  }
]

// Start the tour when component mounts
onMounted(() => start())
</script>

Composable Methods

The useVOnboarding composable provides these methods:

MethodDescription
start()Start the tour from the beginning
finish()End the tour
goToStep(index)Jump to a specific step

Next Steps

Released under the MIT License.