# react-easy-popup

> Welcome to react-easy-popup 👋

Latest version **0.2.4** (published 2020-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-easy-popup
pnpm add react-easy-popup
yarn add react-easy-popup
bun add react-easy-popup
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2020-05-21 |
| First published | 2020-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 55.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Maintainers | haiqiu |
| Keywords | react, component, portal, popup |

## Links

- npm: https://www.npmjs.com/package/react-easy-popup
- Repository: https://github.com/worldzhao/react-easy-popup
- Homepage: https://worldzhao.github.io/react-easy-popup
- Issues: https://github.com/worldzhao/react-easy-popup/issues
- npm.io page: https://npm.io/package/react-easy-popup

## Dependencies (3)

- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [react-transition-group](https://npm.io/package/react-transition-group.md) ^4.4.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.2.4 (latest) — 2020-05-21
- 0.2.3 — 2020-05-20
- 0.2.2 — 2020-05-20
- 0.2.1 — 2020-05-20
- 0.2.0 — 2020-05-19
- 0.1.1 — 2020-05-19

## README

<h1 align="center">Welcome to react-easy-popup 👋</h1>
<p>
  <a href="#" target="_blank">
    <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
  </a>
</p>

### 🏠 [Homepage](https://worldzhao.github.io/react-easy-popup)

React Component based on `ReactDOM.createPortal` function for transportation element.

## Install

```sh
yarn add react-easy-popup

# or

npm i react-easy-popup
```

## Usage

```jsx
import React, { useState } from 'react';
import { Popup } from 'react-easy-popup';
import 'react-easy-popup/dist/react-easy-popup.min.css';

export default () => {
  const [visible, setVisible] = useState(false);
  return (
    <>
      <button onClick={() => setVisible(true)}>click me</button>
      <Popup maskClosable visible={visible} onClose={() => setVisible(false)}>
        <div className="your-content">hello world</div>
      </Popup>
    </>
  );
};
```

## API

| Property       | Description                                                                                    | Type                                           | Default  |
| -------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------- | -------- |
| visible        | Optional，control content visibility                                                           | boolean                                        | false    |
| position       | Optional，determines where the content will pop up                                             | 'center' / 'top' / 'bottom' / 'left' / 'right' | 'center' |
| mask           | Optional，decide whether to display the background layer                                       | boolean                                        | true     |
| maskClosable   | Optional，if the value is true, clicking on the background layer will trigger onClose function | boolean                                        | false    |
| onClose        | Optional，a function to set the visible to false                                               | function                                       | ()=>{}   |
| node           | Optional，the mounted node                                                                     | HTMLElement                                    | -        |
| destroyOnClose | Optional，whether content nodes are unloaded when closed                                       | boolean                                        | false    |
| wrapClassName  | Optional，className for the container node                                                     | string                                         | ''       |

## Contributions Welcome!

```sh
git clone git@github.com:worldzhao/react-easy-popup.git
cd react-easy-popup
yarn
yarn start
```

open another terminal tab

```sh
cd example
yarn
yarn start
```

## Run tests

```sh
yarn test
```

## Author

👤 **海秋**

## Show your support

Give a ⭐️ if this project helped you!

---

_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

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