# react-smooth-modal

> A Smooth Modal dialog for React.JS

Latest version **0.0.22** (published 2021-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-smooth-modal
pnpm add react-smooth-modal
yarn add react-smooth-modal
bun add react-smooth-modal
```

## 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.0.22 |
| Published | 2021-01-18 |
| First published | 2020-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 142.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lsx |
| Maintainers | liushuxiang1993 |
| Keywords | modal, draggable, fullscreen, smooth, component, components, react, react-component |

## Links

- npm: https://www.npmjs.com/package/react-smooth-modal
- Repository: https://github.com/Peek-A-Booo/react-smooth-modal
- npm.io page: https://npm.io/package/react-smooth-modal

## 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.0.22 (latest) — 2021-01-18
- 0.0.21 — 2020-12-25
- 0.0.20 — 2020-12-25
- 0.0.19 — 2020-12-23
- 0.0.18 — 2020-12-23
- 0.0.17 — 2020-12-23
- 0.0.16 — 2020-12-22
- 0.0.15 — 2020-12-22
- 0.0.14 — 2020-12-22
- 0.0.13 — 2020-12-21
- 0.0.12 — 2020-12-19
- 0.0.11 — 2020-12-19
- 0.0.10 — 2020-12-19
- 0.0.9 — 2020-12-19
- 0.0.8 — 2020-12-19
- … 7 more at https://npm.io/package/react-smooth-modal/versions

## README

# React Smooth Modal

A Smooth Modal which can be fullscreen and draggable dialog for React.JS.

![gzip size](https://img.badgesize.io/https:/unpkg.com/react-smooth-modal@0.0.16/dist/react-smooth-modal.cjs.production.min.js?compression=gzip)


## Installation

```bash
 # If you use npm:
 npm install react-smooth-modal

 # Or if you use Yarn:
 yarn add react-smooth-modal
```


## Usage

Here is a example of react-smooth-modal being used in React with hooks: 

```tsx
 import React, { useState } from 'react';
 import Modal from 'react-smooth-modal';

 const App = () => {
    const [visible, setVisible] = useState(false);
    return (
        <div>
            <Modal
                title="Test Title"
                visible={visible}
                onCancel={() => setVisible(false)}
            >
                Hello World!
            </Modal>
        </div> 
    )
 }
```

## Documentation

Coming soon!

## API

| Name                  | Type               | Default       | Description                                         |
| --------------------- | ------------------ | ------------- | --------------------------------------------------- |
| afterClose            | function()         | -             | Callback when the modal close                       |
| bodyStyle             | CSSProperties      | -             | The modal body style                                |
| borderRadius          | number / string    | 5px           | BorderRadius of modal container                     |
| cancelText            | string             | 取消           | The cancel button text                              |
| canFullscreen         | boolean            | false         | Whether the modal can fullscreen                    |
| centerd               | boolean            | false         | Centered Modal                                      |
| className             | string             | -             | The modal container className                       |
| closable              | boolean            | true          | Whether a close (x) button is visible or not        |
| draggable             | boolean            | false         | Can be draggable                                    |
| escClosable           | boolean            | true          | Whether support press esc to close                  |
| footer                | ReactNode          | -             | The modal's footer                                  |
| maskClosable          | boolean            | true          | Whether to close the modal when the mask is clicked |
| onCancel              | function()         | -             |                                                     |
| onSure                | function()         | -             |                                                     |
| sureText              | string             | 确定           | The sure button text                                |
| title                 | ReactNode / string | -             | The modal's title                                   |
| visible               | boolean            | false         | Whether the modal is visible or not                 |
| width                 | number / string    | 500px         | The modal's width                                   |
| zIndex                | number             | 1001          | The z-index of the Modal                            |

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