vue3-driver

Drive the user's focus across the page with Vue and Driver.js.
9,326
Install
npm install vue3-driver
Latest Version:0.1.0
Vue:3
License:MIT
Last Updated:Feb 12, 2024
Links: npm
Maintainer: wobsoriano

vue-driver

Drive the user's focus across the page with Vue and Driver.js.

Install

npm install vue3-driver

Usage

Install the plugin

import { VueDriver } from 'vue3-driver'
import 'driver.js/dist/driver.css'

const app = createApp(App)
app.use(VueDriver)

Use directive to add steps, and composable to start driving

<script setup>
import { useDriver } from 'vue3-driver'

const driver = useDriver()

onMount(() => {
  driver.drive()
})
</script>

<template>
  <header v-driver-step="{ popover: { title: 'Header', description: 'Description' } }">
    <h1>Welcome to My Website</h1>
  </header>

  <main v-driver-step="{ popover: { title: 'Main', description: 'Description' } }">
    Some content...
  </main>

  <footer v-driver-step="{ popover: { title: 'Footer', description: 'Description' } }">
    2023 My Website. All rights reserved.
  </footer>
</template>

Indexing

By default, the steps run from top to bottom depending on the directive placements. If you want to customize the arrangement, you can add an index property to the directive value, or via modifiers:

<template>
  <header v-driver-step="{ index: 0, popover: {} }" />
  <main v-driver-step.2="{ popover: {} }" />
  <footer v-driver-step.1="{ popover: {} }" />
</template>

Highlight

You can pass a ref when you want to highlight an element as well:

import { onMount, ref } from 'vue'
import { useDriver } from 'vue3-driver'

const driver = useDriver()
const element = ref<HTMLElement | null>(null)

onMount(() => {
  driver.highlight({
    element,
    popover: {}
  })
})

License

MIT

Related Packages

coodde-vue3-tour

Coodde Vue Tour is a lightweight, simple and customizable tour plugin for use wi...

457 2
@system76/design

System76 styles and design related web assets

1,665 6
intro-ts

Better introductions for websites and features with a step-by-step guide for you...

2,592 2
v-tour

Simple user guide tour for your Vue.js apps.

2,392 1
vue-beginner-guide

A novice boot component based on vue

1,014

Version History

Version Released Vue License
0.1.0 >=3.2.0 MIT
0.0.1 >=3.2.0 MIT