Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react16-modal-bootstrap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react16-modal-bootstrap

Modal component for ReactJS with Bootstrap style. React16 support.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Modal Bootstrap (React 16)

Modal component for React with bootstrap style.

Fork of @zbuttram branch react-16-radium-fix published to NPM.

Installation

NPM

npm install --save react16-modal-bootstrap

Bower

bower install --save react16-modal-bootstrap

Usage

Dependencies

Webpack:

require('path/to/bootstrap.css');

Without Webpack:

<link rel="stylesheet" type="text/css" href="path/to/bootstrap.css">

JS

import {
  Modal,
  ModalHeader,
  ModalTitle,
  ModalClose,
  ModalBody,
  ModalFooter
} from 'react-modal-bootstrap';
...
state = {
  isOpen: false
};

openModal = () => {
  this.setState({
    isOpen: true
  });
};

hideModal = () => {
  this.setState({
    isOpen: false
  });
};
...
<Modal isOpen={this.state.isOpen} onRequestHide={this.hideModal}>
  <ModalHeader>
    <ModalClose onClick={this.hideModal}/>
    <ModalTitle>Modal title</ModalTitle>
  </ModalHeader>
  <ModalBody>
    <p>Ab ea ipsam iure perferendis! Ad debitis dolore excepturi
      explicabo hic incidunt placeat quasi repellendus soluta,
      vero. Autem delectus est laborum minus modi molestias
      natus provident, quidem rerum sint, voluptas!</p>
  </ModalBody>
  <ModalFooter>
    <button className='btn btn-default' onClick={this.hideModal}>
      Close
    </button>
    <button className='btn btn-primary'>
      Save changes
    </button>
  </ModalFooter>
</Modal>

Styles

Default:

backdropStyles = {
  base: {
    background: 'rgba(0, 0, 0, .7)',
    opacity: 0,
    visibility: 'hidden',
    transition: 'all 0.4s',
    overflowX: 'hidden',
    overflowY: 'auto'
  },
  open: {
    opacity: 1,
    visibility: 'visible'
  }
};

dialogStyles = {
  base: {
    top: -600,
    transition: 'top 0.4s'
  },
  open: {
    top: 0
  }
}

Custom:

You can set custom styles vie backDropStyles, dialogStyles prop.

UMD

<link rel="stylesheet" type="text/css" href="path/to/bootstrap.css">
<script src="path/to/react16-modal-bootstrap/dist/react16-modal-bootstrap.js"></script>
...
var Modal = window.ReactModalBootstrap.Modal;
var ModalHeader = window.ReactModalBootstrap.ModalHeader;
var ModalTitle = window.ReactModalBootstrap.ModalTitle;
var ModalClose = window.ReactModalBootstrap.ModalClose;
var ModalBody = window.ReactModalBootstrap.ModalBody;
var ModalFooter = window.ReactModalBootstrap.ModalFooter;
...

Example here

Props

NameTypeDefaultDescription
isOpenboolfalse
backdropbooltrueClose when click on backdrop
keyboardbooltrueClose when press ESC
sizestring'''modal-lg' or 'modal-sm'
onRequestHidefunctionfunction(){}Callback when modal request hide
backdropStylesobject{}Styles object (Radium)
dialogStylesobject{}Styles object (Radium)

Example

View demo or example folder.

Keywords

FAQs

Package last updated on 04 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc