An open API service indexing awesome lists of open source software.

https://github.com/dotmind/react-modals

React Modals is a tool to quickly generate modals
https://github.com/dotmind/react-modals

modal reactjs typescript

Last synced: about 1 year ago
JSON representation

React Modals is a tool to quickly generate modals

Awesome Lists containing this project

README

          


Logo


@dotmind/react-modals



React Modals is a tool to quickly generate modals












## Menu

- [Menu](#menu)
- [βœ‹ Disclaimer](#-disclaimer)
- [πŸ’» Installation](#-installation)
- [πŸ‘·β€β™‚οΈ How it's work](#️-how-its-work)
- [Modal usage](#modal-usage)
- [⚑️ Contributing](#️-contributing)
- [πŸ” License](#-license)

## βœ‹ 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](https://reactjs.org/blog/2022/03/29/react-v18.html#new-client-and-server-rendering-apis))

Version 2.0.3+ require React 18+

## πŸ’» Installation

```bash
yarn add @dotmind/react-modals
```

or

```bash
npm i @dotmind/react-modals
```

## πŸ‘·β€β™‚οΈ How it's work



React Modals sandbox

### Modal usage

```javascript
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 (


Test react modal


Click me !

This is modal content


You can put your html here, have fun !




);
};
```

| props | description | required | type |
| -------------------- | -------------------------------- | -------- | ---------------------- |
| modalOpen | Modal state | true | boolean |
| onClose | Close modal function | true | () => void |
| children | Modal content | true | ReactNode |
| containerZIndex | Add custom z-index to container | false | number |
| closeButtonElement | Modify close button element | false | ReactElement or string |
| closeButtonClassName | Add custom class on close button | false | string |
| containerClassName | Add custom class on container | false | string |
| contentClassName | Add custom class on content | false | string |
| closeOnClickOutside | Close modal on click outside | false | boolean |
| showCloseButton | Hide or show button button | false | boolean |
| withShadow | Add default box shadow | false | boolean |

## ⚑️ 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](https://choosealicense.com/licenses/mit/)