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

@jaymyong66/simple-modal

v0.0.7

Published

Displays a dialog with a custom content that requires attention or provides additional information.

Readme

Modal

Displays a dialog with a custom content that requires attention or provides additional information. It also provides three modal components that utilize base-modal.

  • Alert Modal
  • Confirm Modal
  • Prompt Modal

installation

npm install @jaymyong66/simple-modal

Component spec

🎯 Base Modal

The main component to display a modal.

| prop name | type | default value | description | | --------- | ------------------------- | ------------- | ------------------------------------------- | | children | ReactNode | | childrens of modal component | | isOpen | boolean | | The state of the modal being open or closed | | onToggle | () => void | | the handler function to toggle modal | | position | 'center' \| 'bottom' | center | position of modal on display |

ModalHeader

The header of the modal.

| prop name | type | default value | description | | --------- | ----------- | ------------- | ------------------------------ | | children | ReactNode | | childrens of Modal component | | title | string | | title of modal |

ModalContent

The body of the modal. (example - checkbox, input, textarea)

| prop name | type | default value | description | | --------- | ----------- | ------------- | ------------------------------------- | | children | ReactNode | | childrens of ModalContent component |

ModalFooter

The footer of the modal. (example - buttons)

| prop name | type | default value | description | | --------- | ----------- | ------------- | ------------------------------------ | | children | ReactNode | | childrens of ModalFooter component |

use example

import { Modal } from '@jaymyong66/simple-modal';

const OtherModal = () => {
  const [isOpen, setIsOpen] = useState(false);
  const handleToggle = () => setIsOpen((prev) => !prev);

  return (
    <Modal position="center" isOpen={isOpen} onToggle={handleToggle}>
      <Modal.ModalHeader title="카드사 선택"></Modal.ModalHeader>
      <Modal.ModalContent>
        <CheckBoxField />
      </Modal.ModalContent>
      <Modal.ModalFooter>
        <ConfirmButton />
      </Modal.ModalFooter>
    </Modal>
  );
};

Features

When the modal opens

  • Dimmed outside the modal
  • Content behind a modal is inert, meaning that users cannot interact with it.

When the modal closes

  • Pressing ESC key closes the modal
  • Click dimmed to close

🎯 Alert Modal

A modal that informs the user of a message and has a confirmation button.

| prop name | type | default value | description | | --------- | -------------------------------- | ------------- | ------------------------------------------- | | isOpen | boolean | | The state of the modal being open or closed | | onToggle | () => void | | The handler function to toggle modal | | onConfirm | () => void | | The handler function to click event of confirm button | | position | 'center' \| 'bottom' | center | Position of modal on display | | size | 'large' \| 'medium' \| 'small' | large | Size of modal on display | | title | string | | Title of modal header | | caption | string | | Caption of modal header | | confirmButtonLabel | string | | Caption of confirm button |

use example

import { AlertModal } from '@jaymyong66/simple-modal';

const OtherModal = () => {
  const [isOpen, setIsOpen] = useState(false);
  const handleToggle = () => setIsOpen((prev) => !prev);
  const handleConfirm = () => {
    console.log('confirm');
    handleToggle();
  };

  return (
    <AlertModal
      position="center"
      size="small"
      isOpen={isOpen}
      onToggle={handleToggle}
      onConfirm={handleConfirm}
      title="아이디를 입력해주세요."
      caption="아이디는 필수로 입력해야 합니다."
      confirmButtonLabel="확인"
    />
  );
};

🎯 Confirm Modal

A modal that gives the user a choice and has confirm and cancel buttons

| prop name | type | default value | description | | --------- | -------------------------------- | ------------- | ------------------------------------------- | | isOpen | boolean | | The state of the modal being open or closed | | onToggle | () => void | | The handler function to toggle modal | | onConfirm | () => void | | The handler function to click event of confirm button | | position | 'center' \| 'bottom' | center | Position of modal on display | | size | 'large' \| 'medium' \| 'small' | large | Size of modal on display | | title | string | | Title of modal header | | caption | string | | Caption of modal header | | confirmButtonLabel | string | | Caption of confirm button | | cancelButtonLabel | string | | Caption of cancel button |

use example

import { ConfirmModal } from '@jaymyong66/simple-modal';

const OtherModal = () => {
  const [isOpen, setIsOpen] = useState(false);
  const handleToggle = () => setIsOpen((prev) => !prev);
  const handleConfirm = () => {
    console.log('confirm');
    handleToggle();
  };

  return (
    <ConfirmModal
      position="center"
      size="small"
      isOpen={isOpen}
      onToggle={handleToggle}
      onConfirm={handleConfirm}
      title="카드를 삭제하시겠습니까?"
      caption="삭제하면 복구하실 수 없습니다."
      confirmButtonLabel="확인"
      confirmButtonLabel="취소"
    />
  );
};

🎯 Prompt Modal

A modal with an input field to receive input from the user and an OK/Cancel button.

| prop name | type | default value | description | | --------- | -------------------------------- | ------------- | --------------------------------------------------------------- | | isOpen | boolean | | The state of the modal being open or closed | | onToggle | () => void | | The handler function to toggle modal | | onChange | () => void | | A handler function that receives the value of the change event. | | onSubmit | (value: string) => void | | A handler function that receives the value of the submit event. | | position | 'center' \| 'bottom' | center | Position of modal on display | | size | 'large' \| 'medium' \| 'small' | large | Size of modal on display | | title | string | | Title of modal header | | value | string | | Value received from user | | confirmButtonLabel | string | | Caption of confirm button | | cancelButtonLabel | string | | Caption of cancel button |

use example

import { PromptModal } from '@jaymyong66/simple-modal';

const OtherModal = () => {
  const [isOpen, setIsOpen] = useState(false);
  const [value, setValue] = useState('');
  const handleToggle = () => setIsOpen((prev) => !prev);
  const handleChange = (e: ChangeEvent<HTMLInputElement>) => setValue(e.target.value);
  const handleSubmit = (value: string) => {
    console.log(value);
    handleToggle();
  }

  return (
    <PromptModal
      position="bottom"
      size="medium"
      isOpen={isOpen}
      onToggle={handleToggle}
      title="쿠폰 번호를 입력해 주세요."
      value={value}
      onChange={handleChange}
      onSubmit={handleSubmit}
      confirmButtonLabel="확인"
      confirmButtonLabel="취소"
    />
  );
};