Nuxt module for Driver.js
npm install nuxt-driver[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]
A Nuxt 3 module that brings the powerful Driver.js library to your Nuxt applications. Create beautiful, interactive product tours, feature highlights, and user onboarding flows with minimal effort. The module provides a declarative and programmatic API, supporting both CSS selectors and Vue template refs for maximum flexibility. With built-in TypeScript support, reactive state management, and a rich set of features, you can create engaging user experiences while maintaining full control over the tour flow and appearance.
- 🎨 Fully Typed: Complete TypeScript support with type definitions
- 🔌 Auto-import: Driver.js components and composables are auto-imported
- 🛠️ Flexible API: Choose between declarative and programmatic usage
- 🔄 Reactive State: Track tour progress and state with reactive properties
- 🎯 Multiple Targeting: Use CSS selectors or template refs to target elements
- 🎭 Custom Components: Built-in Tour component with slot support
- ✨ Directive Support: v-step and v-highlight directives for easy integration
- 🔄 Progress Tracking: Built-in progress indicators for multi-step tours
- 🎨 Customizable: Full access to Driver.js configuration options
1. Add the module to your Nuxt project:
``bash`
npx nuxi module add nuxt-driver
2. The module will automatically register the necessary components and composables.
The useDriver composable provides programmatic control over tours. There are two ways to use it:
#### Method 1: With CSS Selectors
`vue
First step content
Second step content
`
#### Method 2: With Template Refs
`vue
First step content
Second step content
`
The Tour component provides a declarative way to create tours using the v-step directive. Note: The v-step directive can only be used inside a Tour component.
`vue`
Welcome to Our App
Our Amazing Features
Highlight important elements anywhere in your app:
`vue
v-highlight="{
title: 'Important Feature',
description: 'Click here to perform an important action',
active: shouldHighlight
}"
>
Important Button
`
#### useDriver Return Valuedrive(stepIndex?)
- : Start the tour or go to a specific stepisActive
- : Whether the tour is currently activestate
- : Current driver.js statehasNextStep
- : Whether there's a next stephasPreviousStep
- : Whether there's a previous stepactiveIndex
- : Current step indexactiveStep
- : Current step configurationpreviousStep
- : Previous step configurationactiveElement
- : Currently highlighted DOM elementpreviousElement
- : Previously highlighted DOM element
#### Tour Componentsteps
- Props:
- : Array of step configurations (alternative to using v-step)drive
- All other Driver.js configuration options are supported
- Slot Props:
- : Function to start the tourisActive
- : Boolean indicating if tour is activeactiveStep
- : Current active step configurationactiveIndex
- : Current step indexuseDriver`
- All other state properties from
This module is built on top of the amazing Driver.js library by Kamran Ahmed.
Driver.js is a light-weight, no-dependency, vanilla JavaScript engine to drive user's focus across the page. It's MIT licensed and can be found at driverjs.com.
[npm-version-src]: https://img.shields.io/npm/v/nuxt-driverjs/latest.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://www.npmjs.com/package/nuxt-driver
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-driverjs.svg?style=flat&colorA=020420&colorB=00DC82
[npm-downloads-href]: https://www.npmjs.com/package/nuxt-driver
[license-src]: https://img.shields.io/npm/l/nuxt-driverjs.svg?style=flat&colorA=020420&colorB=00DC82
[license-href]: https://www.npmjs.com/package/nuxt-driver
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
[nuxt-href]: https://nuxt.com