Tour Basics

A tour is a list of steps. Each step highlights an element and describes it in a popover. Pass the steps to driver() and call drive().

Animated Tour

The highlight glides from one step to the next by default. Users move with the buttons or the arrow keys, and close with Escape.

import { driver } from "driver.js";
import "driver.js/dist/driver.css";

const driverObj = driver({
  showProgress: true,
  steps: [
    {
      element: ".page-header",
      popover: {
        title: "Header",
        description: "Search lives here.",
        side: "bottom",
      },
    },
    {
      element: ".sidebar",
      popover: { title: "Sidebar", side: "right" },
    },
    { popover: { title: "Happy Coding" } },
  ],
});

driverObj.drive();

Animation Duration

duration sets how long the move between steps and the fade-in take, in milliseconds. The default is 400.

import { driver } from "driver.js";
import "driver.js/dist/driver.css";

const driverObj = driver({
  duration: 150,
  steps: [
    // ...
  ],
});

driverObj.drive();

Static Tour

animate: false turns the animation off. The highlight jumps straight to each step.

import { driver } from "driver.js";
import "driver.js/dist/driver.css";

const driverObj = driver({
  animate: false,
  steps: [
    // ...
  ],
});

driverObj.drive();

Tour Progress

showProgress: true shows the step count in the popover’s bottom left corner, as {{current}} of {{total}}. Change the text with progressText.

import { driver } from "driver.js";
import "driver.js/dist/driver.css";

const driverObj = driver({
  showProgress: true,
  progressText: "Step {{current}} of {{total}}",
  steps: [
    // ...
  ],
});

driverObj.drive();

Both can be set per step in its popover as well.