# @matthieumelin/mm-react-modal

> A simple plugin for create modal.

Latest version **2.7.0** (published 2022-08-12) · 0 weekly downloads

## Install

```sh
npm install @matthieumelin/mm-react-modal
pnpm add @matthieumelin/mm-react-modal
yarn add @matthieumelin/mm-react-modal
bun add @matthieumelin/mm-react-modal
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.7.0 |
| Published | 2022-08-12 |
| First published | 2022-08-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matthieu Melin |
| Maintainers | matthieumelin |
| Keywords | react, components, ui, modal |

## Links

- npm: https://www.npmjs.com/package/@matthieumelin/mm-react-modal
- Repository: https://github.com/matthieumelin/mm-react-modal
- Homepage: https://github.com/matthieumelin/mm-react-modal#readme
- Issues: https://github.com/matthieumelin/mm-react-modal
- npm.io page: https://npm.io/package/@matthieumelin/mm-react-modal

## Dependencies (6)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.8.1
- [react-scripts](https://npm.io/package/react-scripts.md) 5.0.1
- [@babel/polyfill](https://npm.io/package/@babel/polyfill.md) ^7.12.1
- [styled-components](https://npm.io/package/styled-components.md) ^5.3.5

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 2.7.0 (latest) — 2022-08-12
- 2.6.0 — 2022-08-12
- 2.5.0 — 2022-08-10
- 2.4.0 — 2022-08-10
- 2.3.0 — 2022-08-10
- 2.2.0 — 2022-08-10
- 2.1.0 — 2022-08-10
- 2.0.0 — 2022-08-10
- 1.9.0 — 2022-08-10
- 1.8.0 — 2022-08-10
- 1.7.0 — 2022-08-10
- 1.6.0 — 2022-08-10
- 1.5.0 — 2022-08-10
- 1.4.0 — 2022-08-10
- 1.3.0 — 2022-08-10
- … 1 more at https://npm.io/package/@matthieumelin/mm-react-modal/versions

## README

# React Modal Plugin

A simple plugin for create modal for React.js

## Features

- Custom style on components
- Dynamic display control

# Get started

**Requirements**
- React 18.2.0+

**Installation**
- Using npm `npm install @matthieumelin/mm-react-modal`
- Using yarn `yarn add @matthieumelin/mm-react-modal`

**Usage**
- ``isOpen`` (boolean): variable controlling the display of the modal
- ``message`` (string): custom message written on the modal
- ``onConfirm`` (function): action triggered when clicking on the 'closed' icon (& triggered on clicking outside the modal if no action is provided for this action).
- ``customModal`` (object): custom background of the modal
- ``customCloseButton`` (object): custom style of the close button
- ``customMessage`` (object): custom style of the message written on the modal
- ``customContainer`` (object): custom style of the modal
- ``onClickOutside`` (function): action triggered when clicking outside the modal

*App.js (default)*
```javascript
import React, { useState } from "react";
import Modal from "@matthieumelin/mm-react-modal";

const App = () => {
  const [modalIsOpen, setModalIsOpen] = useState(false);

  return (
    <div className="App">
      <div onClick={() => setModalIsOpen(!modalIsOpen)}>
        Click here to open modal
      </div>

      <Modal
      message={"Employeee Created!"}
      isOpen={modalIsOpen} 
      onConfirm={toggleModal}/>
    </div>
  );
}
export default App;
```

*App.js (with custom style)*
```javascript
import React, { useState } from "react";
import Modal from "@matthieumelin/mm-react-modal";

const App = () => {
  const [modalIsOpen, setModalIsOpen] = useState(false);

  return (
    <div className="App">
      <div onClick={() => setModalIsOpen(!modalIsOpen)}>
        Click here to open modal
      </div>

      <Modal customCloseButton={{
        position: "absolute",
        right: -10,
        top: -10,
        width: 15,
        height: 15,
        display: "flex",
        justifyContent: "center",
        alignItems: "center",
        padding: 15,
        borderRadius: 100,
      }}
      customMessage={{ textAlign: "center", width: "100%" }}
      customContainer={{ position: "relative", height: 50, width: 400 }}
      message={"Employeee Created!"}
      isOpen={modalIsOpen} 
      onConfirm={toggleModal}/>
    </div>
  );
}
export default App;
```

---
_Source: https://npm.io/package/@matthieumelin/mm-react-modal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
