JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 364
  • Score
    100M100P100Q109413F
  • License MIT

A beautiful and customizable website tour guide component for React applications

Package Exports

  • @gajendra-naphade/react-web-guide
  • @gajendra-naphade/react-web-guide/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@gajendra-naphade/react-web-guide) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Web Guide 🚀

A beautiful and customizable website tour guide component for React applications. Help your users navigate through your website with an interactive and engaging tour experience.

Features ✨

  • 🎯 Interactive cursor-based tour guide
  • 🎨 Fully customizable styling
  • 📱 Responsive design
  • 🔄 Progress tracking
  • ⚡ Smooth animations
  • 🎭 Minimizable interface
  • 🌈 Beautiful default UI with gradient effects

Installation and Setup 📦

This package utilizes Tailwind CSS for its styling. To ensure the styles are applied correctly in your project, please follow these steps:

  1. Install Tailwind CSS (if you haven't already):

    If your project doesn't have Tailwind CSS set up, install it and its peer dependencies:

    npm install -D tailwindcss postcss autoprefixer
    npx tailwindcss init -p

    Refer to the official Tailwind CSS documentation for framework-specific installation guides.

  2. Install React Web Guide:

    Install the package using npm:

    npm install @gajendra-naphade/react-web-guide
  3. Include Package Styles:

    Import the package's compiled CSS file in your main application entry point or where you are using the package (e.g., src/main.jsx, src/App.jsx, or your root layout file):

    import '@gajendra-naphade/react-web-guide/dist/index.css';
  4. Configure Tailwind Content:

    Add the path to the package's CSS file in your project's tailwind.config.js content array. This ensures that Tailwind processes the @apply directives used within the package's styles:

    // tailwind.config.js
    export default {
      content: [
    "./index.html",
    "./src/**/*.{js,ts,jsx,tsx}",
     "./node_modules/@gajendra-naphade/react-web-guide/dist/**/*.{js,ts,jsx,tsx}"

], theme: { extend: {}, }, plugins: [], } ```

Quick Start 🚀

import { TourGuide } from '@gajendra-naphade/react-web-guide';
import '@gajendra-naphade/react-web-guide/dist/index.css';

function App() {
  const steps = [
    {
      ref: yourRef,
      name: "Guide Name",
      color: "#ff6b6b",
      message: "Your message here",
      offsetX: 0, 
      offsetY: 0
    }
    // ... more steps
  ];

  return (
    <TourGuide 
      steps={steps}
      onComplete={() => console.log('Tour completed!')}
      startButtonText="Start Tour"
      skipButtonText="Skip Tour"
      showProgress={true}
      ProgressTheme="Light"
    />
  );
}

Props Documentation 📚

TourGuide Component Props

Prop Type Default Description
steps Array [] Array of tour steps (required)
onComplete Function - Callback when tour completes
startButtonText String "Start Tour" Text for the start button
skipButtonText String "Skip Tour" Text for the skip button
minimizedStartText String "Start" Text for minimized start button
minimizedSkipText String "Skip" Text for minimized skip button
showProgress Boolean true Show/hide progress indicator
ProgressTheme String "Light" Progress theme ("Light" or "Dark")
buttonPosition Object { bottom: '1.5rem', right: '1.5rem' } Position of the control button
expandedButtonClassName String - CSS classes for expanded button
minimizedButtonClassName String - CSS classes for minimized button
buttonStyle Object {} Custom styles for buttons
CloseButtonText ReactNode <X size={16} /> Close button content
ExpandButtonText ReactNode <Maximize2 size={16} /> Expand button content
minimizedButtonStyle Object - Styles for minimized button
closeButtonClassName String - CSS classes for close button
expandButtonClassName String - CSS classes for expand button
closeButtonStyle Object {} Custom styles for close button
expandButtonStyle Object {} Custom styles for expand button
cursorImage String null Custom cursor image URL
messageBoxStyle Object {} Custom styles for message box
cursorStyle Object {} Custom styles for cursor
nextButtonText String "Next →" Text for next button
nextButtonContinueText String "Continue" Text for continue button
nextButtonClassName String - CSS classes for next button
nextButtonStyle Object {} Custom styles for next button

Step Object Structure

interface Step {
  ref: React.RefObject<HTMLElement>;  // Reference to the target element
  name: string;                       // Name shown in the cursor
  message: string;                    // Message to display
  color?: string;                     // Custom color for the cursor
  offsetX?: number;                   // Custom X offset for cursor position
  offsetY?: number;                   // Custom Y offset for cursor position
}

Example Usage 🎯

import { useRef } from 'react';
import { TourGuide } from '@gajendra-naphade/react-web-guide';
import '@gajendra-naphade/react-web-guide/dist/index.css';

function App() {
  const buttonRef = useRef(null);
  const featureRef = useRef(null);
  const settingsRef = useRef(null);

  const tourSteps = [
    {
      ref: buttonRef,
      name: "Welcome",
      message: "Click here to start your journey!",
      color: "#ff6b6b",
       offsetX: 0,
      offsetY: 0
    },
    {
      ref: featureRef,
      name: "Features",
      message: "Discover our amazing features!",
      color: "#4CAF50",
       offsetX: 0,
      offsetY: 0
    },
    {
      ref: settingsRef,
      name: "Settings",
      message: "Customize your experience here.",
      color: "#2196F3",
       offsetX: 0,
      offsetY: 0
    }
  ];

  return (
    <div>
      <button ref={buttonRef}>Start</button>
      <div ref={featureRef}>Features Section</div>
      <div ref={settingsRef}>Settings Section</div>

      <TourGuide 
        steps={tourSteps}
        onComplete={() => console.log('Tour completed!')}
        startButtonText="Begin Tour"
        showProgress={true}
        ProgressTheme="Dark"
      />
    </div>
  );
}

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request.

License 📄

MIT License - feel free to use this component in your projects!


Made with ❤️ by [Gajendra-Naphade]