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-tutorial-copilot

v1.1.0

Published

A guided tutorial/copilot component for React and React Native

Downloads

115

Readme

react-tutorial-copilot

A guided tutorial/copilot component for React and React Native. Highlight elements on your page and walk users through step-by-step onboarding flows.

Installation

# npm
npm install react-tutorial-copilot

# yarn
yarn add react-tutorial-copilot

Quick Start

import {
  CopilotMangerProvider,
  Copilot,
  CopilotItem,
  useCopilotManger,
} from 'react-tutorial-copilot';

function App() {
  return (
    <CopilotMangerProvider>
      <TutorialContent />
    </CopilotMangerProvider>
  );
}

function TutorialContent() {
  const { registerCopilotSteps, onStart } = useCopilotManger();

  useEffect(() => {
    registerCopilotSteps('onboarding', {
      steps: [
        {
          stepId: 'step_1',
          item: (
            <CopilotItem title="Welcome">
              <p>This is the first step of the tutorial.</p>
            </CopilotItem>
          ),
        },
        {
          stepId: 'step_2',
          item: (
            <CopilotItem title="Next Feature" buttonText="Finish">
              <p>Here is another feature to explore.</p>
            </CopilotItem>
          ),
        },
      ],
    });
  }, []);

  const handleStart = async () => {
    const status = await onStart('onboarding');
    console.log('Tutorial ended with status:', status);
  };

  return (
    <div>
      <Copilot copilotId="step_1">
        <button>Feature A</button>
      </Copilot>

      <Copilot copilotId="step_2">
        <button>Feature B</button>
      </Copilot>

      <button onClick={handleStart}>Start Tutorial</button>
    </div>
  );
}

API Reference

<CopilotMangerProvider>

Context provider that manages tutorial state. Wrap your app or page with this component.

<Copilot>

Wraps a target element to be highlighted during a tutorial step.

| Prop | Type | Default | Description | |------|------|---------|-------------| | copilotId | string | required | Unique identifier matching a step's stepId | | isActive | boolean | true | Whether this target is active |

<CopilotItem>

The tooltip/popover UI displayed next to the highlighted element.

| Prop | Type | Default | Description | |------|------|---------|-------------| | title | string | — | Title text for the step | | buttonText | string | "下一步" | Custom text for the next button | | canSkip | boolean | true | Whether the user can skip the tutorial | | children | ReactNode | — | Custom content for the step |

useCopilotManger()

Hook to access tutorial controls.

| Property | Type | Description | |----------|------|-------------| | registerCopilotSteps(key, groupSteps) | function | Register a set of tutorial steps | | onStart(type) | (type: string) => Promise<COPILOT_STATUS> | Start a tutorial flow, resolves when finished | | onFinish(status?) | function | Manually end the tutorial | | nextStep() | function | Advance to the next step | | prevStep() | function | Go back to the previous step | | copilotType | string \| null | Currently active tutorial type | | currentStepIndex | number | Current step index (1-based) | | totalSteps | number | Total number of steps |

GroupSteps

interface GroupSteps {
  beforeNext?: (currentStepInfo: { stepId: string }) => Promise<boolean> | boolean;
  steps: { stepId: string; item: ReactNode }[];
}
  • beforeNext — Optional async guard called before advancing. Return false to prevent navigation.

COPILOT_STATUS

enum COPILOT_STATUS {
  SKIP,                // User skipped the tutorial
  FINISH,              // User completed all steps
  NOT_FOUND,           // No steps registered for the given type
  UNEXPECTED_BEHAVIOR, // Unexpected error
}

Platform Support

| Platform | Support | |----------|---------| | React (Web) | ✅ | | React Native | ✅ |

The package automatically uses the correct implementation based on the platform:

  • Web — Uses pure DOM APIs (getBoundingClientRect, CSS transitions)
  • React Native — Uses native APIs (View.measure, Animated)

No additional configuration is needed.

License

MIT