1.1.5 • Published 9 years ago

react-simple-modal v1.1.5

Weekly downloads
22
License
MIT
Repository
github
Last release
9 years ago

react-simple-modal

NPM

dependencies

React modal make it simple.

How use it

Download it with:

npm i -S react-simple-modal

Then import it in your code:

import Modal from 'react-simple-modal';

Now you can use it as any React component.

Enjoy!

Props

className

Define your own className property to the modal, must be a string, is optional, default 'Modal'.

onClickOverlay

A function to be called when the user clicked the overlay, must be a function, is required.

opacity

Define the opacity of the overlay, must be a number between 0 and 1, is optional, default 0.5.

visible

Define is the Modal is visible, must be a boolean, is required.

Example

import React from 'react';
import Modal from 'react-simple-modal';

const App = React.createClass({
  getInitialState() {
    return {
      visible: true,
    };
  },
  onClickOverlay() {
    this.setState({
      visible: false,
    });
  },
  render() {
    return (
      <Modal onClickOverlay={this.onClickOverlay} visible={this.state.visible}>
        <h1>Hello world!</h1>
      </Modal>
    );
  },
});

React.render(<App />, document.body);
1.1.5

9 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago