Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

react-maxwell-modal

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-maxwell-modal

A react component for awesome modals

latest
Source
npmnpm
Version
2.0.7
Version published
Maintainers
1
Created
Source

React-Maxwell-Modal

Build Status

Coverage Status

React-Maxwell-Modal Github Page

Install

npm install react-maxwell-modal --save

Usage

There are four types of modals available

Content Modal

Props

PropTypeRequired
onShowfunctionfalse
onHidefunctiontrue
isOpenboolfalse
shouldCloseOnOverlayClickboolfalse
import { ContentModal } from 'react-maxwell-modal';

class ContentModalExample extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false
    }
    this.displayName = 'ContentModalExample';
    this.toggleModal = this.toggleModal.bind(this);
  }

  toggleModal() {
    this.setState({
      isOpen: !this.state.isOpen
    })
  }
  render() {
    return (
      <div className="ClickMeMaxwellModal">
      <button onClick={this.toggleModal}>Load Modal</button>
      <ContentModal
      ref="mymodal"
      isOpen={this.state.isOpen}
      shouldCloseOnOverlayClick={true}
      onHide={this.toggleModal}
      >
        <span>A bunch of useless stuff</span>
        </ContentModal>
      </div>
      );
  }
}

Maxwell Modal

Props

PropTypeRequired
footerReactComponent/Stringfalse
onShowfunctionfalse
onHidefunctiontrue
titlestringfalse
isOpenboolfalse
dismissableboolfalse
shouldCloseOnOverlayClickboolfalse
import { MaxwellModal } from 'react-maxwell-modal';

class MaxwellModalExample extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false
    }
    this.displayName = 'MaxwellModalExample';
    this.toggleModal = this.toggleModal.bind(this);
  }

  toggleModal() {
    this.setState({
      isOpen: !this.state.isOpen
    })
  }
  render() {
    return (
      <div className="ClickMeMaxwellModal">
      <button onClick={this.toggleModal}>Load Modal</button>
      <MaxwellModal
      ref="mymodal"
      isOpen={this.state.isOpen}
      title={"this is a title"}
      shouldCloseOnOverlayClick={true}
      onHide={this.toggleModal}
      >
        <span>A bunch of useless stuff</span>
        </MaxwellModal>
      </div>
      );
  }
}

Confirm Modal

A replacement for the confirm box. This produces a modal with two buttons, yes and no. Their labels are configurable, as well as what occurs on yes and no.

####Props

PropTypeRequired
onYesfunctionfalse
onNofunctionfalse
yesLabelstringfalse
noLabelstringfalse
onShowfunctionfalse
onHidefunctiontrue
titlestringfalse
isOpenboolfalse
dismissableboolfalse
shouldCloseOnOverlayClickboolfalse
import { ConfirmModal } from 'react-maxwell-modal';

class ConfirmModalExample extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false
    }
    this.displayName = 'ConfirmModalExample';
    this.toggleModal = this.toggleModal.bind(this);
    this.onYes = this.onYes.bind(this);
    this.onNo = this.onNo.bind(this);
  }
  onYes(closeModal) {
    closeModal(true)
  }
  onNo(closeModal) {
    closeModal(true)
  }
  toggleModal() {
    this.setState({
      isOpen: !this.state.isOpen
    })
  }
  render() {
    return (
      <div className="ClickMeMaxwellModal">
      <button onClick={this.toggleModal}>Load Modal</button>
      <ConfirmModal
      ref="mymodal"
      isOpen={this.state.isOpen}
      shouldCloseOnOverlayClick={true}
      onHide={this.toggleModal}
      onYes={this.onYes}
      onNo={this.onNo}
      >
        <span>A bunch of useless stuff</span>
        </ConfirmModal>
      </div>
      );
  }
}

Alert Modal

A replacement for the alert box

Props

PropTypeRequired
onYesfunctionfalse
yesLabelstringfalse
onShowfunctionfalse
onHidefunctiontrue
titlestringfalse
isOpenboolfalse
dismissableboolfalse
shouldCloseOnOverlayClickboolfalse
import { AlertModal } from 'react-maxwell-modal';

class AlertModalExample extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isOpen: false
    }
    this.displayName = 'AlertModalExample';
    this.toggleModal = this.toggleModal.bind(this);
    this.onYes = this.onYes.bind(this);
  }
  onYes(closeModal) {
    closeModal(true)
  }
  toggleModal() {
    this.setState({
      isOpen: !this.state.isOpen
    })
  }
  render() {
    return (
      <div className="ClickMeMaxwellModal">
      <button onClick={this.toggleModal}>Load Modal</button>
      <AlertModal
      ref="mymodal"
      isOpen={this.state.isOpen}
      shouldCloseOnOverlayClick={true}
      onHide={this.toggleModal}
      onYes={this.onYes}
      >
        <span>A bunch of useless stuff</span>
        </AlertModal>
      </div>
      );
  }
}

Keywords

modal

FAQs

Package last updated on 13 Apr 2017

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