# react-bootstrap-modal

> React Bootstrap Modal ===================================

Latest version **4.2.0** (published 2018-09-24) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2018-09-24 |
| First published | 2015-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 52.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 88 |
| Author | Jason Quense |
| Maintainers | monastic.panic |
| Keywords | react-boostrap-modal, react-component, modal, portal, dialog, bootstrap |

## Links

- npm: https://www.npmjs.com/package/react-bootstrap-modal
- Repository: https://github.com/jquense/react-bootstrap-modal
- Homepage: https://github.com/jquense/react-bootstrap-modal#readme
- Issues: https://github.com/jquense/react-bootstrap-modal/issues
- npm.io page: https://npm.io/package/react-bootstrap-modal

## Dependencies (6)

- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.1
- [dom-helpers](https://npm.io/package/dom-helpers.md) ^3.3.1
- [react-overlays](https://npm.io/package/react-overlays.md) ^0.8.0
- [prop-types-extra](https://npm.io/package/prop-types-extra.md) ^1.1.0
- [react-transition-group](https://npm.io/package/react-transition-group.md) ^2.0.0

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 4.2.0 (latest) — 2018-09-24
- 2.0.0-beta1 (next) — 2015-08-17
- 4.1.1 — 2018-06-20
- 4.1.0 — 2018-06-19
- 4.0.0 — 2017-10-31
- 3.0.1 — 2016-10-18
- 3.0.0 — 2016-09-09
- 2.1.0 — 2016-04-15
- 2.0.0 — 2015-11-02
- 1.2.1 — 2015-07-15
- 1.2.0 — 2015-07-15
- 1.1.1 — 2015-07-15
- 1.1.0 — 2015-07-15
- 1.0.2 — 2015-04-06
- 1.0.1 — 2015-03-26
- … 1 more at https://npm.io/package/react-bootstrap-modal/versions

## README

React Bootstrap Modal
===================================

Partly a port of [jschr's bootstrap modal](https://github.com/jschr/bootstrap-modal/). Reimplements the Twitter Bootstrap Modal component in a React friendly way. Based on the original work of the react-bootstrap team.

__note__: React bootstrap modal is compatible with bootstrap __3.3.4+__ if you want to use it with an earlier version of bootstrap 3 you need to override the `.modal-backdrop` styles to be the most recent one.

## Features

- Scoped focus
- Stackable! (use with constraint)
- Animated feedback when trying to close a "static" Modal
- Straightforward API, no ModalTrigger or Overlay mixins to deal with

## Use

```js
var Modal = require('react-bootstrap-modal')

class ModalExample extends React.Component {

  render(){
    let closeModal = () => this.setState({ open: false })

    let saveAndClose = () => {
      api.saveData()
        .then(() => this.setState({ open: false }))
    }

    return (
      <div>
        <button type='button'>Launch modal</button>

        <Modal
          show={this.state.open}
          onHide={closeModal}
          aria-labelledby="ModalHeader"
        >
          <Modal.Header closeButton>
            <Modal.Title id='ModalHeader'>A Title Goes here</Modal.Title>
          </Modal.Header>
          <Modal.Body>
            <p>Some Content here</p>
          </Modal.Body>
          <Modal.Footer>
            // If you don't have anything fancy to do you can use
            // the convenient `Dismiss` component, it will
            // trigger `onHide` when clicked
            <Modal.Dismiss className='btn btn-default'>Cancel</Modal.Dismiss>

            // Or you can create your own dismiss buttons
            <button className='btn btn-primary' onClick={saveAndClose}>
              Save
            </button>
          </Modal.Footer>
        </Modal>
      </div>
    )
  }
}

ReactDOM.render(<ModalExample />, document.body);
```

### Styles

If you are already including Twitter Bootstrap styles (e.g. `bootstrap.min.css`), then include `/lib/css/rbm-patch.css`.
If you want to use this module without Twitter Bootstrap, then include `/lib/css/rbm-complete.css`.

If you do not like the Bootstrap visual look and feel, you can adjust `variables.less` to suit your needs and transpile it to css yourself.

## Components

### `Modal`

The main Modal Component.

#### Props

- `show`: `Boolean(default false)` make the Modal visible or hidden
- `backdrop`: `Enum<'static', true, false>(default true)` - Should the modal render a backdrop overlay. `"static"` backdrops are not dismissible by clicking the backdrop.
- `keyboard`: `Boolean(default true)` Modal is dismissible via the `esc` key

- `transition` `Boolean(default true)` Fade the entry and exit of the modal. You can also provide a
Transition component from the `react-transition-group` v2 library to customize the animation more minutely.
- `attentionClass`: `String(default 'shake')` - an animation class added to the modal when a "static" backdrop is clicked, set to nothing if
no animation is desired
- `container`: `Node(default document.body)`, a DOM Node to append the modal too
- `onEnter`: handler fires right before the Modal animates in
- `onEntering`: handler fires as the Modal starts entering
- `onEntered`: handler fires after the enter animation finishes
- `onExit`: handler fires right before the Modal animates out
- `onExiting`: handler fires as the Modal starts exiting
- `onExited`: handler fires after the exit animation finishes

### `Modal.Header`

The Header section of Modal. If not included be sure to add an `aria-labelledby` elsewhere to keep the Modal accessible.

#### Props
  - `closeButton`: `Boolean(default true)` - render a close button or not
  - `onClose`: `Function()` - a Handle when the close button is clicked. if left `undefined` the Header will automatically wire itself into the parent Modal `onHide()`, so you only need to specify a handler if you want a different behavior

### `Modal.Title`

### `Modal.Body`

The main content of the Modal, a convenience Component for: `<div className='modal-body'>content</div>`

### `Modal.Footer`

The bottom footer of the Modal, a convenience Component for: `<div className='modal-footer'>content</div>`

### `Modal.Dismiss`

A dismiss button for the Parent Modal. `Dismiss` button will trigger its parent Modal `onHide()` handler. You don't need to use a Dismiss button, they are just a Convenience Component.

### `Modal.BaseModal`

BaseModal represents just the modal markup without any of the logic to render it to the `document.body`. It is generally not recommended that you work with this component directly. You can use it if you really want to render a Modal inline.

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