# @esseb92/react-modal

> A reusable React modal component with customizable styles.

Latest version **0.2.0** (published 2023-09-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2023-09-08 |
| First published | 2023-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | EsseB92 |
| Maintainers | esseb92 |
| Keywords | react, modal |

## Links

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

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2023-09-08
- 0.1.4 — 2023-09-08
- 0.1.3 — 2023-09-08
- 0.1.2 — 2023-09-07
- 0.1.1 — 2023-09-07
- 0.1.0 — 2023-09-07

## README

# React Modal Component

A reusable React modal component with customizable styles.

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Props](#props)
- [Examples](#examples)

## Installation

To use this component in your React project, you can install it via npm or yarn:

```bash
npm install @esseb92/react-modal
# or
yarn add @esseb92/react-modal
```

## Usage

Import the Modal component into your React application:

```javascript
import Modal from "@esseb92/react-modal";
import "@esseb92/react-modal/Modal.css";
```

Then, you can use the Modal component in your application:

```javascript
<Modal
  closeModal: setOpenModal,
  maxWidth: "500px"
  // Other props for customization
/>
```

## Props

The Modal component accepts the following props:

### Global Part

- `closeModal`: A function to close the modal.
- `maxWidth`: Maximum width of the modal.
- `closingBtn`: A URL for a closing button image.
- `borderRadius`: Border radius of the modal.
- `padding`: Padding of the modal.
- `margin`: Margin of the modal.
- `fontFamily`: Font family for the modal.

### Header Part

- `modalHeader`: Header text for the modal.
- `colorHeader`: Text color for the header.
- `bgColorHeader`: Background color for the header.
- `textAlignHeader`: Text alignment for the header.
- `fontSizeHeader`: Font size for the header.
- `paddingHeader`: Padding for the header.
- `marginHeader`: Margin for the header.

### Body Part

- `modalBody`: Content for the modal body.
- `colorBody`: Text color for the body.
- `bgColorBody`: Background color for the body.
- `textAlignBody`: Text alignment for the body.
- `fontSizeBody`: Font size for the body.
- `paddingBody`: Padding for the body.
- `marginBody`: Margin for the body.

### Footer Part

- `modalFooter`: Content for the modal footer.
- `colorFooter`: Text color for the footer.
- `bgColorFooter`: Background color for the footer.
- `textAlignFooter`: Text alignment for the footer.
- `fontSizeFooter`: Font size for the footer.

## Examples

Here's an example of how to use the Modal component:

```javascript
import Modal from "@esseb92/react-modal";
import "@esseb92/react-modal/Modal.css";
```

```javascript
const [openModal, setOpenModal] = useState(false);
const contentBody = (
  <p>
    Thanks for clicking. That felt good. <br />
    Click <a
      href="#"
      onClick={() => {
        setOpenModal(false);
      }}
      className="clickable"
    >
      close
    </a>, click the overlay, or press ESC
  </p>
);
```

```javascript
{openModal && (
  <Modal
    // Global Part
    closeModal: setOpenModal,
    maxWidth: "500px",
    closingBtn: XMarkIcon,
    borderRadius: "8px",
    padding: "15px 30px",
    fontFamily: '"Lato", "Helvetica Neue", arial, sans-serif',
    // Body Part
    modalBody: contentBody,
    colorBody: "#5e6c76",
    bgColorBody: "white",
    textAlignBody: "left",
    fontSizeBody: "18px",
    paddingBody: "0",
  />
)
}
```

![Alt text](image.png)

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