# react-smart-popup

> simple popup created with react and typescrypt and styled components

Latest version **2.9.1** (published 2022-07-11) · ISC license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.9.1 |
| Published | 2022-07-11 |
| First published | 2022-07-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mahmoud Okily |
| Maintainers | heshamalamam73 |
| Keywords | popup, dialog, typescrypt, react |

## Links

- npm: https://www.npmjs.com/package/react-smart-popup
- Repository: https://github.com/heshamalamam73/react-smart-popup
- Homepage: https://github.com/heshamalamam73/react-smart-popup#readme
- Issues: https://github.com/heshamalamam73/react-smart-popup/issues
- npm.io page: https://npm.io/package/react-smart-popup

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^18.2.0
- [styled-components](https://npm.io/package/styled-components.md) ^5.3.5

## 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

- 2.9.1 (latest) — 2022-07-11
- 2.8.2 — 2022-07-11
- 2.8.1 — 2022-07-11
- 2.8.0 — 2022-07-11
- 2.7.2 — 2022-07-11
- 2.7.1 — 2022-07-11
- 2.6.0 — 2022-07-11
- 2.5.0 — 2022-07-11
- 2.4.0 — 2022-07-11
- 2.3.0 — 2022-07-11
- 2.1.0 — 2022-07-11
- 2.0.0 — 2022-07-11
- 1.1.1 — 2022-07-11
- 1.1.0 — 2022-07-11
- 1.0.5 — 2022-07-11
- … 5 more at https://npm.io/package/react-smart-popup/versions

## README

# react-smart-popup

this is a smart popup created by react and typeScrypt

## Installation

The package can be installed via [npm](https://github.com/npm/cli):

```
npm install react-smart-popup --save
```

Or via [yarn](https://github.com/yarnpkg/yarn):

```
yarn add react-smart-popup
```

## Example

```js
import React, { useState, useCallback } from 'react';
import { popup } from 'react-smart-popup';

const App = () => {
  const [isOpenDialog, setIsOpenDialog] = useState < boolean > false;

  const openPopupFunc = useCallback(() => {
    setIsOpenDialog(true);
  }, [setIsOpenDialog]);
  const handleSubmitFunc = useCallback(() => {
    console.log('submit');
  }, []);
  const handleCloseFunc = useCallback(() => {
    console.log('close');
  }, []);

  return (
    <div>
      <button onClick={openPopupFunc}>Open popup </button>
      <Popup
        isOpen={isOpenDialog}
        setIsOpen={setIsOpenDialog}
        handleSubmit={handleSubmitFunc}
        handleClose={handleCloseFunc}
      >
        hello world
      </Popup>
    </div>
  );
};
```

### Props

| Property           | type      | Default Value | Description                           |
| ------------------ | --------- | ------------- | ------------------------------------- |
| isOpen             | Boolean   | false         | state of popup                        |
| setIsOpen          | Func      |               | change state of popup                 |
| children           | ReactNode |               | some children to show in popup body   |
| handleSubmit       | Func      |               | on press submit button handler        |
| handleClose        | Func      |               | on press close button handler         |
| closeOnPressEscape | Boolean   | true          | close active popup when press esc key |
| closeOnClickAway   | Boolean   | true          | close popup when click outside        |
| width              | String    | '50%'         | popup width                           |
| height             | String    | '50%'         | popup height                          |
| header             | String    |               | popup header                          |

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