# react-bootstrap-modality

> React Bootstrap modals made easy 🚀

Latest version **0.2.1** (published 2021-06-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-bootstrap-modality
pnpm add react-bootstrap-modality
yarn add react-bootstrap-modality
bun add react-bootstrap-modality
```

## 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.1 |
| Published | 2021-06-09 |
| First published | 2021-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 296.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Luke Johnstone |
| Maintainers | luketouchfoundry |
| Keywords | bootstrap, react, modal, dialog |

## Links

- npm: https://www.npmjs.com/package/react-bootstrap-modality
- Repository: https://github.com/TouchFoundry/react-bootstrap-modality
- npm.io page: https://npm.io/package/react-bootstrap-modality

## 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.1 (latest) — 2021-06-09
- 0.2.0 — 2021-06-09
- 0.1.6 — 2021-06-02
- 0.1.5 — 2021-06-02
- 0.1.4 — 2021-06-02
- 0.1.3 — 2021-06-02
- 0.1.2 — 2021-06-02

## README

# React-Bootstrap-Modality

![Modality example](./docs/demo.gif)

React-Bootstrap-Modality allows you to display Bootstrap (4) modals with ease. You no longer need to have repetitive
definitions of modals throughout your project.

This project was inspired by [react-toastify](https://github.com/fkhadra/react-toastify).

## Installation

```
$ npm install --save react-bootstrap-modality
$ yarn add react-bootstrap-modality
```

## Features

- Wraps react-bootstraps modal and provides two functions to show and dismiss the modal programmatically
- A few options (with more to come), allowing you to show/hide various buttons, bind a function to the confirm button,
  etc.

## How to use

```jsx
import React from 'react';

import {ModalityContainer, Modality} from 'react-bootstrap-modality';

function App() {
  const showModal = () => Modality.showModal('Some lovely title', 'Some lovely body', {
    // your options go here
    onConfirm: () => {
      //do some lovely action post-confirm
    }
  });

  return (
    <div>
      <button onClick={showModal}>Show Modality!</button>
      <ModalityContainer/>
    </div>
  );
}
```

## Documentation

There are two functions.


##### Show the modal
```ts
Modality.showModal(title, body, options);
```
`title` - string or element

`body` - string or element

`options`
```ts
{
    confirmButton: 'Confirm', // string
    closeButton: 'Close', // string
    onConfirm: undefined, // callback function
    closeOnConfirm: true, // boolean
    displayConfirmButton: true, // boolean
    displayCloseButton: true, // boolean
    displayCloseCross: true // boolean
}
```

##### Dismiss the modal
```ts
Modality.dismissModal();
```

## About the author
Luke Johnstone is lead software engineer at TouchFoundry, a digital consultancy firm based in Cape Town, South Africa. Do [check out our website](https://touchfoundry.co.za) :smile:


## License

Licensed under MIT

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