Socket
Socket
Sign inDemoInstall

@dotmind/react-modals

Package Overview
Dependencies
5
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dotmind/react-modals

Create quickly and easily modals for React. Builded by dotmind.io


Version published
Weekly downloads
3
decreased by-86.36%
Maintainers
5
Created
Weekly downloads
 

Readme

Source
Logo

@dotmind/react-modals

React Modals is a tool to quickly generate modals

Menu

✋ Disclaimer

Create quickly and easily modals for React. Builded by dotmind.io If you’re familiar with the basics of React, you will know that because of its structure you can face some serious CSS issues when you need to show a modal. With this package you can :

  • clip your modal on any page
  • say goodbye to CSS issues
  • saving time and simply customize

Let's code 🚀.

If you use React < 18, please use version 2.0.2 (React 18 changelog)

Version 2.0.3+ require React 18+

💻 Installation

yarn add @dotmind/react-modals

or

npm i @dotmind/react-modals

👷‍♂️ How it's work

React Modals sandbox

Modal usage

import React, { useCallback, useState } from 'react';

import Modal from '@dotmind/react-modals';

const App: React.FC = () => {
  const [modalOpen, setModalOpen] = useState(false);

  const handleChangeModal = useCallback(() => {
    setModalOpen((prevState) => !prevState);
  }, [setModalOpen]);

  return (
    <div>
      <h1>Test react modal</h1>
      <button onClick={handleChangeModal}>Click me !</button>
      <Modal
        modalOpen={modalOpen}
        onClose={handleChangeModal}
        containerZIndex={9999}
      >
        <h1>This is modal content</h1>
        <p>You can put your html here, have fun !</p>
      </Modal>
    </div>
  );
};
propsdescriptionrequiredtype
modalOpenModal statetrueboolean
onCloseClose modal functiontrue() => void
childrenModal contenttrueReactNode
containerZIndexAdd custom z-index to containerfalsenumber
closeButtonElementModify close button elementfalseReactElement or string
closeButtonClassNameAdd custom class on close buttonfalsestring
containerClassNameAdd custom class on containerfalsestring
contentClassNameAdd custom class on contentfalsestring
closeOnClickOutsideClose modal on click outsidefalseboolean
showCloseButtonHide or show button buttonfalseboolean
withShadowAdd default box shadowfalseboolean

⚡️ Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

🔐 License

MIT

Keywords

FAQs

Last updated on 20 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc