npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nuxt-driver

v0.1.2

Published

Nuxt module for Driver.js

Downloads

92

Readme

Nuxt Driver | Driver.js Nuxt Module

npm version npm downloads License Nuxt

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.

Features

  • 🎨 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

Quick Setup

  1. Add the module to your Nuxt project:
npx nuxi module add nuxt-driver
  1. The module will automatically register the necessary components and composables.

Usage

1. Using useDriver Composable

The useDriver composable provides programmatic control over tours. There are two ways to use it:

Method 1: With CSS Selectors

<template>
  <div>
    <button @click="startTour">Start Tour</button>
    <div id="section1">First step content</div>
    <div id="section2">Second step content</div>
  </div>
</template>

<script setup>
const { drive, isActive } = useDriver({
  showProgress: true,
  steps: [
    {
      element: '#section1',
      popover: {
        title: 'First Step',
        description: 'This is the first step of the tour.'
      }
    },
    {
      element: '#section2',
      popover: {
        title: 'Second Step',
        description: 'This is the second step.'
      }
    }
  ]
});

const startTour = () => {
  drive();
};
</script>

Method 2: With Template Refs

<template>
  <div>
    <button @click="startTour">Start Tour</button>
    <div ref="step1">First step content</div>
    <div ref="step2">Second step content</div>
  </div>
</template>

<script setup>
const step1 = ref(null);
const step2 = ref(null);

const { drive, isActive } = useDriver({
  steps: [
    {
      element: step1,
      popover: {
        title: 'First Step',
        description: 'This is the first step of the tour.'
      }
    },
    {
      element: step2,
      popover: {
        title: 'Second Step',
        description: 'This is the second step.'
      }
    }
  ]
});

const startTour = () => {
  drive();
};
</script>

2. Using the Tour Component with v-step

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.

<template>
  <Tour v-slot="{ drive, isActive: isTourActive }">
    <h1 v-step:1="{ title: 'Welcome', description: 'This is the first step' }">
      Welcome to Our App
    </h1>
    
    <div v-step:2="{ title: 'Features', description: 'Check out our features' }">
      Our Amazing Features
    </div>
    
    <button @click="drive">
      {{ isTourActive ? 'Stop Tour' : 'Start Tour' }}
    </button>
  </Tour>
</template>

3. Using v-highlight Directive

Highlight important elements anywhere in your app:

<template>
  <div>
    <button 
      v-highlight="{
        title: 'Important Feature',
        description: 'Click here to perform an important action',
        active: shouldHighlight
      }"
    >
      Important Button
    </button>
  </div>
</template>

<script setup>
const shouldHighlight = ref(true);
</script>

Available Properties and Methods

useDriver Return Value

  • drive(stepIndex?): Start the tour or go to a specific step
  • isActive: Whether the tour is currently active
  • state: Current driver.js state
  • hasNextStep: Whether there's a next step
  • hasPreviousStep: Whether there's a previous step
  • activeIndex: Current step index
  • activeStep: Current step configuration
  • previousStep: Previous step configuration
  • activeElement: Currently highlighted DOM element
  • previousElement: Previously highlighted DOM element

Tour Component

  • Props:
  • Slot Props:
    • drive: Function to start the tour
    • isActive: Boolean indicating if tour is active
    • activeStep: Current active step configuration
    • activeIndex: Current step index
    • All other state properties from useDriver

Credits

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.