# modal-dialog-react-component

> A React component for a modal made with dialog html element

Latest version **1.0.6** (published 2023-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install modal-dialog-react-component
pnpm add modal-dialog-react-component
yarn add modal-dialog-react-component
bun add modal-dialog-react-component
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-06-05 |
| First published | 2023-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 249.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | VB2095 |
| Maintainers | vb2095 |

## Links

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

## Recent versions

- 1.0.6 (latest) — 2023-06-05
- 1.0.5 — 2023-06-05
- 1.0.4 — 2023-06-05
- 1.0.3 — 2023-06-05
- 1.0.2 — 2023-06-05
- 1.0.1 — 2023-05-31
- 1.0.0 — 2023-05-31

## README

# modal-dialog-react-component

> A React component for a modal made with dialog html element

[![NPM](https://img.shields.io/npm/v/modal-dialog-react-component.svg)](https://www.npmjs.com/package/modal-dialog-react-component) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save modal-dialog-react-component
```

## Usage

Where you want to use the modal, import the component and use it like this:

```jsx
import { useEffect } from 'react'

import Modal from 'modal-dialog-react-component'
import 'modal-dialog-react-component/dist/index.css'

class Example extends Component {
  render() {
    const [isModalOpen, setIsModalOpen] = useState(false) // state to control the modal
    return (
      <Modal isOpen={isModalOpen} setIsOpen={setIsModalOpen}>
        {' '}
        {Children}{' '}
      </Modal>
    )
  }
}
```

Then use `setIsModalOpen(true)` to open the modal. It can be used in a button onClick event for example, or when your form is submited.

## Example

```
import React from 'react'
import Modal from 'modal-dialog-react-component'
import { useState } from 'react'
import 'modal-dialog-react-component/dist/index.css'
import 'modal-dialog-react-component/dist/modal.css'
const App = () => {
  const [isModalOpen, setIsModalOpen] = useState(false)
  const handleClick = () => {
    setIsModalOpen(true)
  }
  return (
    <>
      <p>App</p>
      <button onClick={handleClick}>Ouvrir la modal</button>
      <Modal isOpen={isModalOpen} setIsOpen={setIsModalOpen}>
        <p>Modal</p>
      </Modal>
    </>
  )
}

export default App
```

## License

MIT © [VB2095](https://github.com/VB2095)

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