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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-help-overlay

v0.1.0-beta2

Published

A headless library for building interactive help and tutorials into your React app.

Readme

// TODO: Convert this doc from scribbled notes to an actual README. 🙃

Help Overlay

The Idea

You have a global help button that's always visible. You click on the button to enable the help overlay. In this state, any items on the page that have help information will be rendered on top of the overlay, and everything else in the app will be dimmed. When you click on an item, the help popup will appear with the help information for that item.
Additionally, you can designate help items as tutorials. The first time the user interacts with a particular element or feature, the help popup will automatically appear as a one-time tutorial.

The Implementation

The entire system is built around hooks. There are only two components from the library that you need to render in your component tree, and both should be around the root of the DOM.

<HelpProvider data={HELP_DATA} initialState={userState} onUpdateState={storeUserState}>
  <AllTheOtherRootLevelProvidersForMyApp>
  <HelpOverlay renderOverlay={(isActive, props) => <MyBackdropOrOverlay open={isActive} {...props}/>}>
    ... the rest of my app ...
  </HelpOverlay>
</HelpProvider>

Technically only <HelpProvider> is required. The <HelpOverlay> can be implemented manually using the hooks available in the library, if you need further customization.

As this library is headless, you will need to implement the components for rendering the help button and popup. This is made very simple by using the useHelpButton and useHelpPopup hooks.

HelpButton.tsx

import { useHelpButton } from "react-help-overlay";
import { Button } from "your-ui-library";
import { CloseIcon, HelpIcon } from "your-icon-library";

export const HelpButton = () => {
  const [props, isActive] = useHelpButton();
  
  return (
    <Button {...props}>
      {isActive ? <CloseIcon/> : <HelpIcon/>}
    </Button>
  )
}

HelpPopup.tsx

import { useHelpPopup, useHelpActiveContent } from "react-help-overlay";
import { Popup } from "your-ui-library";

export const HelpPopup = () => {
  const [isOpen, attrs, callbacks] = useHelpPopup();
  const activeContent = useHelpActiveContent(callbacks);
  
  return (
    <Popup 
      id="help-popup"
      // make sure these attrs are passed to the root element of the popup window
      // and not the backdrop, to ensure correct the z-indexes are set
      dialogElementProps={attrs}
      open={isOpen}
      closePopup={callbacks.closePopup}
      titleText={activeContent.name}
    >
      {activeContent.content}
    </Popup>
  )
}

Now you can hook up items throughout the application to the help system using useHelpItemAttributes.

InterestingButton.tsx

import { useHelpItemAttributes } from "react-help-overlay";

export const InterestingButton = (props) => {
  const attrs = useHelpItemAttributes("interesting-button");
  
  return (
    <Button {...props} {...attrs}>
      Something Interesting
    </Button>
  );
}

When you click the <HelpButton> and activate the overlay, everything on the page except for <InterestingButton> (and any other help items) will be dimmed. Clicking on <InterestingButton> will open the help popup with the help info for "interesting-button".

Setup

npm install react-help-overlay

Set up help data

help-data.tsx

import type { HelpData, HelpItemData } from "react-help-overlay";

const HELP_DATA_ITEMS = {
  "my-button": {
    key: "my-button",
    name: "My Button",
    content: () => <div>
      <p>This is MyButton. It performs some functionality. Here's how it works:</p>
      <p>...</p>
    </div>,
  },
} as const satisfies { [K in string]: HelpItemData<K> };

export type MyHelpDataItems = typeof HELP_DATA_ITEMS

export const HELP_DATA: HelpData = {
  items: HELP_DATA_ITEMS,
};

augmentations.d.ts

import type { MyHelpDataItems } from "./path/to/help-data.tsx";

declare module "react-help-overlay" {
  interface HelpDataItems extends McmmHelpDataItems {
  }
}

Rendering layers

          Help popup
---------------------------- help popup backdrop ----
   Highlighted help elements (when overlay is active)
          Help button
---------------------------- help overlay backdrop (when overlay is active) ----

the rest of the app