Vue Tour for Vue 3

1.0.3 · active · verified Sun Apr 19

`vue3-tour` is a lightweight, simple, and customizable tour plugin designed specifically for Vue.js 3 applications. It guides users through an application by highlighting elements and displaying contextual information in a step-by-step fashion. Currently at stable version 1.0.3, it is a direct fork of the popular `vue-tour` library, re-engineered for compatibility with the Vue 3 composition API and ecosystem. While release cadence isn't highly frequent, the project shows ongoing maintenance with recent fixes. Key differentiators include its ease of integration with Vue 3's `createApp` pattern, the ability to target any DOM element via standard CSS selectors, and support for asynchronous `before()` functions in steps for complex UI transitions. It ships with TypeScript types, enhancing developer experience in TypeScript projects.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install `vue3-tour`, register the plugin, include necessary styles, define tour steps targeting specific DOM elements, and programmatically start a guided tour.

// main.js
import { createApp } from 'vue';
import App from './App.vue';
import Vue3Tour from 'vue3-tour';
import 'vue3-tour/dist/vue3-tour.css';

const app = createApp(App);
app.use(Vue3Tour);
app.mount('#app');

// App.vue
<template>
  <div>
    <div id="v-step-0" style="margin: 20px; padding: 10px; border: 1px solid blue;">
      A DOM element on your page. The first step will pop on this element.
    </div>
    <div class="v-step-1" style="margin: 20px; padding: 10px; border: 1px solid green;">
      Another element for the second step.
    </div>
    <div data-v-step="2" style="margin: 20px; padding: 10px; border: 1px solid red;">
      The final element for the third step.
    </div>

    <v-tour name="myTour" :steps="steps"></v-tour>
    <button @click="startTour">Start Guided Tour</button>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      steps: [
        {
          target: '#v-step-0',
          header: { title: 'Welcome!' },
          content: `This is the starting point of our application tour.`,
        },
        {
          target: '.v-step-1',
          content: 'Here you will find key information and functionalities.',
        },
        {
          target: '[data-v-step="2"]',
          content: 'And this is where you can take action!',
          params: { placement: 'top' },
        },
      ],
    };
  },
  methods: {
    startTour() {
      if (this.$tours && this.$tours['myTour']) {
        this.$tours['myTour'].start();
      } else {
        console.error("Tour 'myTour' not found. Ensure <v-tour name='myTour'> is rendered.");
      }
    },
  },
  mounted() {
    // Optionally start the tour automatically
    // this.startTour();
  },
};
</script>

view raw JSON →