# @fabiendev/react-modal-component

> Modal component for React JS

Latest version **0.0.10** (published 2023-03-18) · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2023-03-18 |
| First published | 2023-03-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | fabiendev |
| Keywords | modal, custom, accessibility, dark-mode, react, dialog, simple |

## Links

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

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.8.1

## 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.0.10 (latest) — 2023-03-18
- 0.0.9 — 2023-03-17
- 0.0.8 — 2023-03-17
- 0.0.7 — 2023-03-13
- 0.0.6 — 2023-03-13
- 0.0.5 — 2023-03-11
- 0.0.4 — 2023-03-10
- 0.0.3 — 2023-03-10
- 0.0.2 — 2023-03-10

## README

# React Modal Component

## Presentation

Customizable modal component for React JS

## Install the modal

Use NPM command:

```bash
npm i @fabiendev/react-modal-component
```

## Import modal in your project

```js
import  ReactModalComponent  from "@fabiendev/react-modal-component";
```

## Example in component

```js
import { useState } from "react";
import ReactModalComponent  from "@fabiendev/react-modal-component";

const ModalExample = () => {
    const [displayModal, setDisplayModal] = useState(false);
    const toggleModal = () => setDisplayModal(!displayModal);

    return (
        <div>
            <h2>Modal Example</h2>
            <button onClick={toggleModal}>Open Modale</button>
            {displayModal &&
                <ReactModalComponent
                    hideModal={toggleModal}
                    title="Modal Title"
                    darkMode
                    modalSize="large"
                >
                    <p>Message in modal</p>
                </ReactModalComponent>
            }
        </div>
    );
};

export default ModalExample;
```

## Properties

| Properties              | Types    | Required |
| ----------              | ---------| -------- |
| `hideModal`             | function |    X     |
| `title`                 | string   |          |
| `children`              | node     |    X     |
| `darkMode`              | bool     |          |
| `modalSize`             | string   |          |
| `customModalWidth`      | string   |          |
| `customModalHeight`     | string   |          |
| `modalTextColor`        | string   |          |
| `closeBtnContainerColor`| string   |          |


### Properties description

* `hideModal` {function}: Function to hide modal
    * example:
        ```js
            hideModal={toggleModal}
        ```
* `title` {string}: Title of modal
    * example:
        ```js
            title="Modal Title"
        ```
* `children` {node}: Content to display inside modal
    * example:
        ```js
            <ReactModalComponent>
                <p>Message in modal</p>
            </ReactModalComponent>
        ```
* `darkMode` {bool}: Whether to display modal in dark mode
    * example:
        ```js
            darkMode={true}
        ```
* `modalSize` {string}: Predefined size of modal ("large", "medium", "small")
    * example:
        ```js
            modalSize="large"
        ```
* `customModalWidth` {string}: Custom width for modal
    * example:
        ```js
            customModalWidth="500px"
        ```
* `customModalHeight` {string}: Custom height for modal
    * example:
        ```js
            customModalHeight="500px"
        ```
* `modalTextColor` {string}: Text color for modal
    * example:
        ```js
            modalTextColor="#93AD18"
        ```
* `closeBtnContainerColor` {string}: Background color for close button
    * example:
        ```js
            closeBtnContainerColor="#748813"
        ```

## NPM Package
- [@fabiendev/react-modal-component](https://www.npmjs.com/package/@fabiendev/react-modal-component)

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