1.4.11 • Published 9 months ago

@gajendra-naphade/react-web-guide v1.4.11

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

React Web Guide

React Web Guide is a customizable, interactive website tour component for React applications. Guide users through your app with engaging, cursor-based tours to enhance onboarding and user experience.

npm version License GitHub issues


Table of Contents


Features

  • Interactive Tours: Cursor-driven navigation for intuitive user guidance.
  • Customizable Styling: Match your app's branding with ease.
  • Responsive Design: Seamless experience on desktop and mobile.
  • Progress Tracking: Clear indicators to show tour progress.
  • Smooth Animations: Fluid transitions for a polished look.
  • Minimizable UI: Compact interface to save screen space.
  • Modern UI: Beautiful default design with gradient effects.
  • React version Support: Supports React version >=16.

Ideal for user onboarding, feature showcases, and guided tutorials in Web apps.


Demo

See React Web Guide in action:

React Web Guide Demo


Installation

Install React Web Guide via npm, Yarn or pnpm :

npm install @gajendra-naphade/react-web-guide
yarn add @gajendra-naphade/react-web-guide
pnpm add @gajendra-naphade/react-web-guide

Quick Start

Get started in minutes:

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

function App() {
  const buttonRef = useRef(null);
  const tourSteps = [
    {
      ref: buttonRef,
      name: "Guide",
      color: "black",
      message: "This is the header section of your page",
      offsetX: 0,
      offsetY: 0,
      CursorMessageGap:10,
    },
    // Add more steps
  ];

  return (
    <div>
      <button ref={buttonRef}>Start</button>
      <TourGuide
        steps={tourSteps}
        onComplete={() => console.log('Tour completed!')}
      />
    </div>
  );
}

Props Documentation

Customize React Web Guide with these props:

PropTypeDefaultDescription
stepsArray[]Array of tour steps (required)
onCompleteFunction-Callback when tour completes
startButtonTextString"Start Tour"Text for the start button
skipButtonTextString"Skip Tour"Text for the skip button
minimizedStartTextString"Start"Text for minimized start button
minimizedSkipTextString"Skip"Text for minimized skip button
showProgressBooleantrueShow/hide progress indicator
buttonPositionObject{ bottom: '1.5rem', right: '1.5rem' }Position of the control button
expandedButtonClassNameString-CSS classes for expanded button
minimizedButtonClassNameString-CSS classes for minimized button
buttonStyleObject{}Custom styles for buttons
CloseButtonTextReactNode<X size={16} />Close button content
ExpandButtonTextReactNode<Maximize2 size={16} />Expand button content
minimizedButtonStyleObject-Styles for minimized button
closeButtonClassNameString-CSS classes for close button
expandButtonClassNameString-CSS classes for expand button
closeButtonStyleObject{}Custom styles for close button
expandButtonStyleObject{}Custom styles for expand button
cursorImageStringnullCustom cursor image URL
CustomCursorClassStringnullCSS classes for custom cursor
messageBoxStyleObject{}Custom styles for message box
cursorStyleObject{}Custom styles for cursor
nextButtonTextString"Next →"Text for next button
nextButtonContinueTextString"Continue"Text for continue button
nextButtonClassNameString-CSS classes for next button
nextButtonStyleObject{}Custom styles for next button
ThemeString"Light"Theme for the tour ("Light" or "Dark")
MinimizedBooleantrueWhether to start in minimized state
showTooltipBooleantrueShow/hide the start tooltip
messageClassString-CSS classes for the message box

Step Object Structure

interface Step {
  ref: React.RefObject<HTMLElement>; // Target element reference
  name: string;                     // Cursor display name
  message: string;                  // Tour message
  color?: string;                   // Cursor color
  offsetX?: number;                 // X offset for cursor
  offsetY?: number;                 // Y offset for cursor
  CursorMessageGap?: number;        // Gap between cursor and message(in pixels "px")
}

Example Usage

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

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

  const tourSteps = [
    {
      ref: buttonRef,
      name: "Welcome",
      message: "Start your journey here!",
      color: "#ff6b6b",
      CursorMessageGap: 10
    },
    {
      ref: featureRef,
      name: "Features",
      message: "Explore our amazing features!",
      color: "#4CAF50",
      offsetX: 20,
      offsetY: 10
    },
    {
      ref: settingsRef,
      name: "Settings",
      message: "Customize your experience here",
      color: "#2196F3",
      CursorMessageGap: 15
    }
  ];

  return (
    <div>
      <button ref={buttonRef}>Start</button>
      <div ref={featureRef}>Features</div>
      <div ref={settingsRef}>Settings</div>
      <TourGuide
        steps={tourSteps}
        onComplete={() => console.log('Tour completed!')}
        startButtonText="Begin Tour"
        skipButtonText="End Tour"
        minimizedStartText="Start"
        minimizedSkipText="Skip"
        showProgress={true}
        Theme="Dark"
        Minimized={true}
        showTooltip={true}
        buttonPosition={{
          bottom: '2rem',
          right: '2rem'
        }}
        messageClass="custom-message"
        nextButtonText="Next Step"
        nextButtonContinueText="Continue"
        nextButtonClassName="custom-next-button"
      />
    </div>
  );
}

Contributing

We welcome contributions! To get started:

  1. Fork the repo.
  2. Create a branch (git checkout -b feature/YourFeature).
  3. Commit changes (git commit -m 'Add YourFeature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a Pull Request

License

MIT License - Use React Web Guide freely in your projects!


Support


Made with ❤️ by Gajendra Naphade


1.4.11

9 months ago

1.4.10

9 months ago

1.4.9

9 months ago

1.4.8

9 months ago

1.4.7

9 months ago

1.4.6

9 months ago

1.4.5

9 months ago

1.4.4

9 months ago

1.4.3

9 months ago

1.4.2

9 months ago

1.4.1

9 months ago

1.4.0

9 months ago

1.3.1

9 months ago

1.3.0

10 months ago

1.2.5

10 months ago

1.2.4

10 months ago

1.2.3

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago