# @melacod/react-modal

> Basic React Modal

Latest version **1.0.2** (published 2022-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @melacod/react-modal
pnpm add @melacod/react-modal
yarn add @melacod/react-modal
bun add @melacod/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 | 1.0.2 |
| Published | 2022-05-17 |
| First published | 2022-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 30.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | melacod |
| Maintainers | melacod |

## Links

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

## Recent versions

- 1.0.2 (latest) — 2022-05-17
- 1.0.1 — 2022-05-17
- 1.0.0 — 2022-05-17

## README

# react-modal

> Basic React Modal

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

## Install

```bash
npm install --save @melacod/react-modal
```

## Usage

```jsx
import React, { useState } from 'react'
import Modal from '@melacod/react-modal'

const BasicExample = () => {

  const [showModal, setShowModal] = useState(false)
  const hideModal = () => showModal && setShowModal(false)

  return (
    <button onClick={() => setShowModal(true)}>
      Basic modal
    </button>

    <Modal show={showModal} onClickCloseBtn={hideModal} title='Basic modal'>
      <p>I am a basic modal</p>
    </Modal>
  )
}
```

## Advanced usage

```jsx
import React, { useState } from 'react'
import Modal from '@melacod/react-modal'

const CustomizeFooter = () => {
  return <p>My custom footer</p>
}

const CustomizeHeader = () => {
  return <p>My custom header</p>
}

const AdvancedExample = () => {

  const [showModal, setShowModal] = useState(false)
  const hideModal = () => showModal && setShowModal(false)

  return (
    <button onClick={() => setShowModal(true)}>
      Advanced modal
    </button>

    <Modal
      show={showModal}
      onClickCloseBtn={hideModal  }
      footer={<CustomizeFooter />}
      header={<CustomizeHeader />}
      backgroundColor='lightyellow'
      backdropBackgroundColor='rgba(255,165,0, 0.5)'
    >
      <p>I am an advanced modal</p>
    </Modal>
  )
}
```

## License

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

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