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-overlay-modal

v1.0.5

Published

A minimalistic, super lightweight and accessible React modal library that offers robust type safety. This headless solution gives you full flexibility to integrate your own content and styles without worrying about z-index or complex configurations.

Readme

React Overlay Modal

A minimalistic, super lightweight and accessible React modal library that offers robust type safety. This headless solution gives you full flexibility to integrate your own content and styles without worrying about z-index or complex configurations.

Features

  1. No dependencies other than React.
  2. Fully accessible with proper ARIA attributes.
  3. Lightweight and headless (no pre-applied styles).
  4. Typescript support for type safety.
  5. Minimal configuration with support for custom styling.

Demo

View the Demo

Install

npm i react-overlay-modal

Wrap the root app with ModalProvider

import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import App from "./App.tsx"
import { ModalProvider } from "react-overlay-modal"

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <ModalProvider>
      <App />
    </ModalProvider>
  </StrictMode>,
)

Usage


import { useModal } from "react-overlay-modal"

function ModalContent() {
  const { closeModal } = useModal()
  return (
    <div>
      <h2>✨ Welcome to Cool Modal!</h2>
      <button
        onClick={closeModal}
        className="btn secondary"
      >
        ✨ Close Modal
      </button>
    </div>
  )
}

export default function Page() {
  const { showModal } = useModal()
  return (
    <button
      className="btn primary"
      onClick={() => showModal({
        content: <ModalContent />,
        size: "md"
      })}
    >
      ✨ Open Cool Modal
    </button>
  )
}

API

Props

| Property | Type | Default Value | Description | | --------------------- | -------------- | ---------------------------------------- | --------------------------------------------------------- | | size | ModalSize | "md" | Specifies the size of the modal (see ModalSize). | | disableOutsideClick | boolean | false | If true, disables clicking outside the modal to close it. | | content | ReactElement | The content to display inside the modal. | | className | string | undefined | Pass class to handle the overlay style. | | bodyProps | ModalBodyProps | undefined | See body props for more details (see ModalBodyProps) |

Modal Size

| Value | Description | | ------ | ------------------------------ | | sm | Small modal size. | | md | Medium modal size. (default) | | lg | Large modal size. | | xl | Extra-large modal size. | | 2xl | Double extra-large modal size. | | 3xl | Triple extra-large modal size. | | full | Fullscreen modal. |

Modal Body Props

| Property | Description | | ------------------ | --------------------------------------------------------------------- | | className | Optional string for CSS class name | | aria-labelledby | Optional string to reference labeling element(s) | | aria-describedby | Optional string to reference describing element(s) | | aria-hidden | Optional boolean to hide from assistive tech | | aria-live | Optional region updates announcement: "off", "polite", or "assertive" | | aria-modal | Optional boolean indicating if element is modal | | aria-role | Optional string defining element's ARIA role | | tabIndex | Optional number for tab order | | role | Optional string defining element's role | | onKeyDown | Optional keyboard event handler | | onFocus | Optional focus event handler | | id | Optional string identifier | | style | Optional React CSS properties object | | onClick | Optional mouse click event handler |