2.1.4 β€’ Published 1 year ago

@dotmind/react-modals v2.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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

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

2.1.2

1 year ago

2.1.1

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.0.5

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.1.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago