Skip to content
HomeExamplesFirst product tour

Tours · Start here

Your first product tour

Build an accessible, three-step tour of a dashboard with a spotlight, progress and keyboard navigation.

sitetourkit 0.7.1createTour · progress · events

Loading the interactive example…

Make it yours

Download HTML
import { createTour } from "sitetourkit";
import "sitetourkit/styles.css";
let tour;
const status = document.querySelector("#demo-status");
document.querySelector("#run-demo").onclick = async () => {
    tour?.destroy();
    let completed = false;
    tour = createTour({
        progress: true,
        stepNumbers: true,
        steps: [
            {
                target: "#overview",
                title: "Start with the big picture",
                content: "Your workspace overview brings everything together.",
            },
            {
                target: "#activity",
                title: "See what is happening",
                content: "Track the activity that matters to your team.",
            },
            {
                target: "#invite",
                title: "Bring someone along",
                content: "Invite a teammate when you are ready.",
            },
        ],
    });
    tour.on("stepChange", ({ index }) => {
        status.textContent = `Step ${index + 1} of 3`;
    });
    tour.on("complete", () => {
        completed = true;
        status.textContent = "Tour complete. Run it again whenever you like.";
    });
    tour.on("exit", () => {
        if (!completed)
            status.textContent = "Tour closed. You can start again.";
    });
    await tour.start();
};
document.querySelector("#reset-demo").onclick = () => {
    tour?.destroy();
    status.textContent = "Ready to explore. Select Run example.";
    document.querySelector("#action-result").textContent =
        "This workspace is a local example.";
};
document.querySelector("#invite").onclick = () => {
    document.querySelector("#action-result").textContent =
        "Invitation preview opened. No invitation was sent.";
};
window.addEventListener("pagehide", () => tour?.destroy());
Install sitetourkit, then use this with the example markup.

What this example does ​

A short walkthrough introduces three parts of a dashboard: its navigation, activity summary and invitation action. Each step has a target, a title and a brief explanation. The spotlight and tooltip follow the current target automatically.

Select Run example, use Next and Back, then finish with Done. You can also use the arrow keys and close with Escape. The small message below the demo follows the tour's lifecycle events.

Add it to your application ​

Install sitetourkit and include sitetourkit/styles.css. Give the important parts of your interface stable IDs, then describe them in the steps array. Run the tour in response to a user action once those elements are mounted.

The JavaScript and TypeScript tabs use the IDs from this demo. The HTML tab includes the complete markup, styling and script, so you can save it as a page and run it directly.

Keep the walkthrough useful ​

  • Keep each step focused on one action or idea.
  • Use stable selectors that survive normal UI updates.
  • Call destroy() when the component or page that owns the tour is removed.
  • Give returning users a way to replay the tour.