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

pwa-install-guide

v1.0.5

Published

A simple guide to add PWA installation functionality with customizable UI or hooks.

Readme

PWA Install Guide

Introduction

PWA Install Guide simplifies adding Progressive Web App (PWA) installation functionality to your application. The SDK supports two main usage approaches:

  1. Complete Component: Includes pre-built UI and installation logic.
  2. Hook: Provides state and data to customize the installation UI as needed.

desktop_chrome display


Installation

Install the SDK via npm:

npm install pwa-install-guide

or yarn

yarn add pwa-install-guide

Usage

1. Complete Component

Use the pre-built component that comes with ready-to-use UI and logic. Ideal for quick integration of PWA installation functionality.

import { InstallPWAGuideModal } from 'pwa-install-guide';
import 'pwa-install-guide/dist/style.css'


function App() {
  return (
    <div>
      <InstallPWAGuideModal />
    </div>
  );
}

Props (Optional):

| Prop Name | Type | Description | Default Value | | :----------------- | :--------------------------- | :-------------------- | :------------------ | | type | "modal" or "popup" | Appearence Type | "modal" | | header | "JSX.Element" or "undefined" | Modal's Header | "Install PWA Guide" | | containerClassName | "string" or "undefined" | ClassName's Container | "undefined" |

2. Using the Hook

The hook provides state and functions for you to create a custom installation UI.

import { useInstallPWAGuide } from 'pwa-install-guide';

function CustomInstallFlow() {
  const { showPrompt, loading, steps, isOpen, onClose } = useInstallPWAGuide({
    iconWrapper: ({ children }) => (
      <span className="icon-wrapper">{children}</span>
    ),
    onAfterInstall: () => alert("PWA installed successfully!"),
    onBeforeInstall: () => console.log("Preparing to install PWA..."),
    onInstallError: (error) => console.error("Installation error:", error),
  });
  if (!steps && !showPrompt) {
    return <p>PWA is installed or not supported on this browser.</p>;
  }
  return (
    isOpen && (
      <div className="modal">
        {steps ? (
          steps.map((step, index) => (
            <p key={index} className="step">
              {index + 1} {step}
            </p>
          ))
        ) : (
          <button onClick={showPrompt} disabled={loading}>
            {loading ? "Loading..." : "Install PWA"}
          </button>
        )}
        <button onClick={onClose}>Close</button>
      </div>
    )
  )
}

Hook API:

| State/Function | Type | Description | | :------------- | :----------------------------------------- | :---------------------------------------------------------------- | | showPrompt | "() => Promise<void>" or "undefined" | Function to trigger the PWA installation prompt. | | loading | "boolean" | Indicates if the installation process is ongoing. | | steps | "JSX.Element[]" or "undefined" | List of steps to guide the user through the installation process. | | isOpen | "boolean" | Indicates if the installation guide modal is currently open. | | onClose | "() => void" | Function to close the installation guide modal |

| Prop Name | Type | Description | | :-------------- | :--------------------------------------------------------------------- | :---------------------------------------------------------- | | iconWrapper | "({ children }:{children: JSX.Element}) => JSX.Element" or "undefined" | Custom wrapper for icons in installation steps. | | onBeforeInstall | "() => void" or "undefined" | Callback executed before showing the installation prompt. | | onAfterInstall | "() => void" or "undefined" | Callback executed after successful installation. | | onInstallError | "(error?: unknown) => void" or "undefined" | Callback executed when an error occurs during installation. |

License

ISC Licensed. Copyright (c) Esollabs 2024.