# confirmation-modal-lib

> A simple confirmation modal package for React

Latest version **1.6.0** (published 2023-02-23) · 0 weekly downloads

## Install

```sh
npm install confirmation-modal-lib
pnpm add confirmation-modal-lib
yarn add confirmation-modal-lib
bun add confirmation-modal-lib
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2023-02-23 |
| First published | 2023-02-14 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dwain06 |
| Maintainers | dwain06 |
| Keywords | react, component-library, modal |

## Links

- npm: https://www.npmjs.com/package/confirmation-modal-lib
- Repository: https://github.com/Dwain06/confirmation-modal-lib
- Homepage: https://github.com/Dwain06/confirmation-modal-lib#readme
- Issues: https://github.com/Dwain06/confirmation-modal-lib/issues
- npm.io page: https://npm.io/package/confirmation-modal-lib

## Dependencies (5)

- [web-vitals](https://npm.io/package/web-vitals.md) ^2.1.4
- [babel-preset-env](https://npm.io/package/babel-preset-env.md) ^1.7.0
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^13.4.0
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.16.5
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) ^13.5.0

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

- 1.6.0 (latest) — 2023-02-23
- 1.5.0 — 2023-02-21
- 1.4.0 — 2023-02-17
- 1.3.0 — 2023-02-15
- 1.2.0 — 2023-02-15
- 1.1.0 — 2023-02-15
- 1.0.0 — 2023-02-14

## README

# Confirmation-Modal-Lib

Get a confirmation modal for React.

- Fully responsive
- Light and simple
- Add your own text

## How to install

```
npm install confirmation-modal-lib
```

## How to install

- Import by adding `import { ConfirmationModal } from "confirmation-modal-lib"`.
- Use by adding `<ConfirmationModal />`.
- Display the modal on changing useState to true `const [showModal, setShowModal] = useState(false)`.

### Usage

Here's an example of basic usage:

```js
import React, { useState } from "react";
import { ConfirmationModal } from "../lib";

const App = () => {

    const [showModal, setShowModal] = useState(false);

    return (
    <div style={{ width: 640, margin: "15px auto", textAlign: "center", fontFamily: "sans-serif" }}>
        <h1>Testing confirmation modal library</h1>
        <button onClick={() => setShowModal(true)}>Show modal</button>
        <ConfirmationModal
            showModal={showModal}
            setShowModal={setShowModal}
            textContent="This is your confirmation!"
            btnContent="Ok!"
            clickClose={true}
            escapeClose={true}
            colorModal="grey"
        />
    </div>
)};
```

### Custom styling

These class selectors allow you to change the appearance :
- `confirmation-modal` : contains background
- `confirmation-modal__msg` : for message container
- `confirmation-modal__msg--close` : to design close button

## Props

| Props name      | Description                                        | Default value                                   | Example value        |
|-----------------|----------------------------------------------------|-------------------------------------------------|----------------------|
| showModal       | Allows you to display the modal                    | false                                           | true                 |
| setShowModal    | Set show modal to true when you want to display it | --                                              | setShowModal(true)   |
| btnContent      | Text inside close button                           | "Close"                                         | "OK"                 |
| textContent     | Text display by the modal                          | "Insert your text here with 'textContent' prop" | "Successfully send!" |
| fadeinDuration  | Fade in at opening in ms                           | 200                                             | 1000                 |
| fadeinDelay     | Delay for the modal appear                         | 0                                               | 200                  |
| fadeoutDuration | Fade out at closing in ms                          | 200                                             | 1000                 |
| fadeoutDelay    | Delay for the modal close                          | 0                                               | 200                  |
| escapeClose     | Allow you to close the modal on press ESC key      | false                                           | true                 |
| clickClose      | Allow you to close the modal by click outside it   | false                                           | true                 |
| colorModal      | Color of the modal                                 | "grey"                                          | "green"              |
| colorTxtModal   | Text color of the modal                            | --                                              | "white"              |

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