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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-spotlight-tour-cct

v1.3.2

Published

A lightweight and customizable React component for creating guided tours in your web applications. Highlight elements and display step-by-step instructions to guide users through your app's features.

Readme

React Tour Guide

A lightweight and customizable React component for creating guided tours in your web applications. Highlight elements and display step-by-step instructions to guide users through your app's features.


Features

  • Highlight elements on the page.
  • Step-by-step instructions with navigation.
  • Keyboard navigation support.
  • Customizable styles and positions.
  • Progress bar and restart functionality.

Requirements

  • Node.js: v16.0.0 or higher
  • npm: v7.0.0 or higher

Installation

Install the package using npm:

npm install react-spotlight-tour-cct
# or
yarn add react-spotlight-tour-cct

Usage

This package provides a REACT-TOUR-GUIDE component that you can use to guide the novice user with unique features of our website.

Example

import React from "react";
import { TourGuidePopup } from "react-spotlight-tour-cct";
//import "react-spotlight-tour-cct/dist/react-spotlight-tour-cct.css"; // (Optional)

const App = () => {
  const steps = [
    { id: "step1", content: "This is the first step of the tour." },
    { id: "step2", content: "Highlight another feature in this step." },
    { id: "step3", content: "Final step of the tour!" },
  ];

  return (
    <div>
      <h1 id="step1">Welcome to the App</h1>
      <p id="step2">This paragraph is part of the tour.</p>
      <button id="step3">Click me to finish the tour!</button>

      <TourGuidePopup steps={steps} />
    </div>
  );
};

export default App;

Keyboard Shortcuts -- Right Arrow: Navigate to the next step. -- Left Arrow: Navigate to the previous step. -- Escape: Close the tour.

Props

TourGuidePopup Component

| Prop | Type | Description | Required | |-----------|-------------|----------------------------------------------------------------|----------| | steps | TourStep[]| An array of tour steps with id and content. | Yes |

TourStep Interface

interface TourStep {
  id: string;      // The ID of the element to highlight.
  content: string; // The content to display in the popup for this step.
}

CSS Classes

Below are the CSS classes used in the component and their descriptions:

| Class | Description | |----------------------|---------------------------------------------| | button-restart | Styles the "Restart Tour" button. | | tour-guide-popup | Styles the main popup container. | | popup-arrow | Styles the arrow pointing to the target. | | progress-container | Styles the progress bar container. | | progress-bar | Styles the progress bar itself. | | button-close | Styles the close button inside the popup. |

Minimul style of Restart Button

  position: fixed;
  top: 10px;
  right: 10px;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  z-index: 1002;
}

Highlight Component

This component highlights a specific element during the tour by adding a highlighted class to the element identified by its targetId prop.

import React, { useEffect } from "react";
import "./Highlight.css";

interface HighlightProps {
  targetId: string;
}

export const Highlight: React.FC<HighlightProps> = ({ targetId }) => {
  useEffect(() => {
    const targetElement = document.getElementById(targetId);
    if (targetElement) {
      targetElement.classList.add("highlighted");
    }

    return () => {
      const targetElement = document.getElementById(targetId);
      if (targetElement) {
        targetElement.classList.remove("highlighted");
      }
    };
  }, [targetId]);

  return null;
};

Example of highlight element : Screenshot 2025-01-13 173047

Highlight Component

| Prop | Type | Description | Required | |-----------|----------|---------------------------------------------|----------| | targetId| string | The id of the element to highlight. | Yes |

TourGuideButtons Component

This component renders the navigation buttons for the tour, allowing users to move between steps, skip the tour, or finish it. It provides "Previous", "Skip", "Next", and "Finish" buttons based on the current step.

Props

| Prop | Type | Description | Required | |--------------|----------|-------------------------------------------------|----------| | currentStep| number | The current step index in the tour. | Yes | | totalSteps | number | The total number of steps in the tour. | Yes | | onPrevious | function| Function to handle moving to the previous step. | Yes | | onNext | function| Function to handle moving to the next step. | Yes | | onClose | function| Function to handle closing the tour. | Yes |

Example Usage

import React, { useState } from "react";
import { TourGuideButtons } from "react-spotlight-tour-cct";

const TourComponent = () => {
  const [currentStep, setCurrentStep] = useState(0);
  const totalSteps = 3;

  const handlePrevious = () => setCurrentStep((prev) => Math.max(prev - 1, 0));
  const handleNext = () => setCurrentStep((prev) => Math.min(prev + 1, totalSteps - 1));
  const handleClose = () => setCurrentStep(0); // or perform other closing actions

  return (
    <div>
      <h1>Tour Step {currentStep + 1}</h1>
      <TourGuideButtons
        currentStep={currentStep}
        totalSteps={totalSteps}
        onPrevious={handlePrevious}
        onNext={handleNext}
        onClose={handleClose}
      />
    </div>
  );
};

export default TourComponent;

Contributing

Feel free to submit issues or pull requests to improve the package. Contributions are always welcome!