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

tiny-react-dialog

v0.2.2

Published

A simple, lightweight, and customizable React library for displaying modal dialog boxes.

Downloads

267

Readme

tiny-react-dialog

A simple, lightweight, and customizable React library for displaying modal dialog boxes.


Installation

Install the package using npm:

npm install tiny-react-dialog

Or with Yarn:

yarn add tiny-react-dialog

Usage

Import

The core component is TinyReactDialog. The default styles are optional; if you prefer to provide your own styling, you can omit the CSS import.

import { TinyReactDialog } from 'tiny-react-dialog';
// Optional: import default styles
import 'tiny-react-dialog/index.css';

Controlling the Component

TinyReactDialog is a controlled component. You must manage its visibility from your parent component's state using the visible prop and a callback function for the onClose prop.

The onClose callback is triggered when the user clicks the close button or the overlay, allowing you to update your state and close the dialog.

Styling and Customization

The component comes with an optional default CSS file. If you choose not to import it, you can style the dialog yourself using the default CSS class names or by providing your own via the classNames prop.

The component's default structure is:

<div class="tiny-react-dialog__overlay">
    <div class="tiny-react-dialog__container">
        <div class="tiny-react-dialog__content">
            <!-- Content -->
        </div>
        <button class="tiny-react-dialog__close">
            <!-- SVG closing icon -->
        </button>
    </div>
</div>

To add your own classes (for example, with Tailwind CSS), use the classNames prop:

import { TinyReactDialog } from 'tiny-react-dialog';

<TinyReactDialog 
  classNames={{
    overlay: "bg-black/50 backdrop-blur",
    container: "bg-white rounded-lg shadow-lg",
    content: "p-4",
    close: "top-2 right-2 p-1 text-gray-400 hover:text-gray-600"
}} />

Example

Here's a complete example showing how to manage the dialog's state.

import { useState } from "react";
import { TinyReactDialog } from "tiny-react-dialog";
import "tiny-react-dialog/index.css";

export default function Example() {
    const [isDialogVisible, setIsDialogVisible] = useState(false);

    const openDialog = () => {
        setIsDialogVisible(true);
    };

    const closeDialog = () => {
        setIsDialogVisible(false);
    };

    return (
        <>
            <button onClick={openDialog}>Open Dialog</button>

            <TinyReactDialog visible={isDialogVisible} onClose={closeDialog}>
                Dialog Content
            </TinyReactDialog>
        </>
    );
}

Props

The component accepts the following properties:

| Prop | Type | Default Value | Description | |:-------------|:----------------------------|:--------------|:--------------------------------------------------------------------------------| | visible | boolean | false | Determines whether the dialog box is visible or hidden. | | onClose | () => void | Required | A function to be called when the user requests to close the dialog. | | children | ReactNode | undefined | The content to be rendered inside the dialog box. | | classNames | { overlay?: string, ... } | {} | An object for applying custom CSS class names to different parts of the dialog. |