# generic-react-modal

> A very basic React.js modal

Latest version **0.2.7** (published 2023-08-18) · 0 weekly downloads

## Install

```sh
npm install generic-react-modal
pnpm add generic-react-modal
yarn add generic-react-modal
bun add generic-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.7 |
| Published | 2023-08-18 |
| First published | 2023-07-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | M.O.K.K.A. |
| Maintainers | mbzmokka |
| Keywords | react, components, ui, modal |

## Links

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

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [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) ^6.0.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
- [@mesalvo/react-ui](https://npm.io/package/@mesalvo/react-ui.md) — 1.7K weekly downloads

## Recent versions

- 0.2.7 (latest) — 2023-08-18
- 0.2.6 — 2023-08-17
- 0.2.5 — 2023-08-17
- 0.2.4 — 2023-08-01
- 0.2.3 — 2023-08-01
- 0.2.2 — 2023-08-01
- 0.2.1 — 2023-08-01
- 0.2.0 — 2023-08-01
- 0.1.0 — 2023-07-28

## README

# generic-react-modal

Provide simple generic modal components for React.js

<a href="https://www.npmjs.com/package/generic-react-modal"><img alt="npm" src="https://img.shields.io/npm/dw/generic-react-modal"></a>
<a href="https://www.npmjs.com/package/generic-react-modal"><img alt="npm" src="https://img.shields.io/npm/v/generic-react-modal"></a>
<a href="https://www.npmjs.com/package/generic-react-modal"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/generic-react-modal"></a>
<a href="https://www.npmjs.com/package/generic-react-modal">
<img alt="Maintenance Status" src="https://img.shields.io/badge/maintenance-inactive-red.svg" />
</a>

## Table of Contents

-   [Installation](#installation)
-   [Features](#features)
-   [Example](#example)

## Installation

To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com):

    $ npm install generic-react-modal
    $ yarn add generic-react-modal

## Features

-   Modal component : renders a modal and its background. You can easily customize the header's title, body's content, body's padding, background opacity, but also choose it's type (default, error, success), display a close button or allow a click on the background to close the modal.
-   ModalBackground component : just renders a background. You can easily customize the opacity and allow a click on it to close the modal it contains.

## Example

A simple example of a generic-react-modal used to show a modal when the user successfully send a form:

```jsx
import React from "react";
import ReactDOM from "react-dom";
import { Modal } from "generic-react-modal";

function App() {
    const [modalIsOpen, setModalIsOpen] = React.useState(false);
    function openModal() {
        setModalIsOpen(true);
    }

    return (
        <div>
            <button onClick={openModal}>Send form</button>
            <Modal
                opened={modalIsOpen}
                setOpened={setModalIsOpen}
                type="success"
                title="Form sent"
                paddingH={40}
                paddingV={20}
            >
                <p>
                    We have received your answers. Thank you for participating
                    in this survey!
                </p>
            </Modal>
        </div>
    );
}

ReactDOM.render(<App />, appElement);
```

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