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

@alisdev/fe-kit-modal

v2.0.2

Published

A multi-layered, dynamic modal stacking system for React. It automatically handles `z-index` layering, backdrop blurring, and focus management when you open modals on top of other modals.

Readme

@alisdev/fe-kit-modal

A multi-layered, dynamic modal stacking system for React. It automatically handles z-index layering, backdrop blurring, and focus management when you open modals on top of other modals.

Features

  • 📚 Unlimited Stacking: Open a modal from within a modal. The kit automatically tracks depth, applies backdrops only to the top-most layer, and manages keyboard focus.
  • 🗄️ Declarative & Imperative APIs: Use the standard <Modal> component, or trigger modals via the modal.open() command from anywhere.
  • 🎨 Sleek OS-level Designs: Built-in styling options for macos and windows window controls.
  • 🚪 Focus Trapping: Automatically traps keyboard focus inside the active modal for accessibility.
  • 🎭 Smooth Transitions: Coordinated entry and exit animations for both the modal container and the backdrop.

Installation

pnpm add @alisdev/fe-kit-modal

Global Setup

You must mount the ModalStack at the root of your application. This is the container where imperative modals are injected.

import { ModalStack } from "@alisdev/fe-kit-modal";

function App() {
  return (
    <>
      <Router />
      <ModalStack />
    </>
  );
}

1. Imperative API (Best for Dynamic Content)

The imperative API is highly recommended for forms, detail views, and complex flows because you don't need to bloat your component state with multiple isOpen booleans.

import { modal } from "@alisdev/fe-kit-modal";
import { UserEditForm } from "./UserEditForm";

function handleEditUser(userId: string) {
  const modalId = modal.open({
    title: "Edit User Profile",
    // You can pass raw strings, or full React components
    content: <UserEditForm userId={userId} onSave={() => modal.close(modalId)} />,
    size: "lg", // "sm" | "md" | "lg" | "full"
    theme: "macos", // "default" | "macos" | "windows"
    closeOnBackdropClick: false // Prevent accidental closures
  });
}

Stacked Modals

You can call modal.open from inside the UserEditForm component. The system will automatically dim the Edit User Profile modal and render the new modal on top of it.

// Inside UserEditForm.tsx
function handleSelectAvatar() {
  modal.open({
    title: "Select Avatar",
    content: <AvatarPicker />,
    size: "sm"
  });
}

2. Declarative API (Standard Component)

If you prefer standard React state patterns, the <Modal> component offers the exact same features and connects to the same stacking context automatically.

import { useState } from "react";
import { Modal } from "@alisdev/fe-kit-modal";

export function ProfileSettings() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <div>
      <button onClick={() => setIsOpen(true)}>Open Settings</button>

      <Modal 
        isOpen={isOpen} 
        onClose={() => setIsOpen(false)} 
        title="Account Settings"
        size="md"
        theme="windows"
      >
        <Modal.Body>
          <p>Update your email, password, and preferences here.</p>
        </Modal.Body>
        
        <Modal.Footer>
          <button className="btn-secondary" onClick={() => setIsOpen(false)}>
            Cancel
          </button>
          <button className="btn-primary" onClick={() => save()}>
            Save Changes
          </button>
        </Modal.Footer>
      </Modal>
    </div>
  );
}

API Reference

ModalConfig (for modal.open) / ModalProps

| Property | Type | Default | Description | | :--- | :--- | :--- | :--- | | title | string \| ReactNode | "" | The header title. | | content | ReactNode | - | (Imperative only) The body of the modal. | | size | "sm" \| "md" \| "lg" \| "full" | "md" | Controls the max-width of the dialog container. | | theme | "default" \| "macos" \| "windows" | "default" | Stylizes the header and close buttons. | | closeOnBackdropClick | boolean | true | Allows closing by clicking outside the modal. | | closeOnEscape | boolean | true | Allows closing via the Escape key. | | hideCloseButton | boolean | false | Removes the 'X' button from the header. |

modal Utility Methods

  • modal.open(config): Opens a new modal and returns a unique string ID.
  • modal.close(id): Closes a specific modal.
  • modal.closeTop(): Automatically closes whichever modal is currently at the top of the stack (useful for generic "Cancel" buttons).
  • modal.closeAll(): Instantly removes all modals from the screen.