Giter Club home page Giter Club logo

react-awesome-modal's Introduction

Deprecated

This repository is deprecated. But I created a new modal package which uses react hooks. It's easier and more intuitive. Prease look at the new repository.

https://github.com/shibe97/react-hooks-use-modal

react-awesome-modal

Build Status

This is a Customizable Modal.

http://shibe97.github.io/react-awesome-modal/

demo

Usage

import React, { Component } from 'react';
import Modal from 'react-awesome-modal';

export default class Examples extends Component {
    constructor(props) {
        super(props);
        this.state = {
            visible : false
        }
    }

    openModal() {
        this.setState({
            visible : true
        });
    }

    closeModal() {
        this.setState({
            visible : false
        });
    }

    render() {
        return (
            <section>
                <h1>React-Modal Examples</h1>
                <input type="button" value="Open" onClick={() => this.openModal()} />
                <Modal visible={this.state.visible} width="400" height="300" effect="fadeInUp" onClickAway={() => this.closeModal()}>
                    <div>
                        <h1>Title</h1>
                        <p>Some Contents</p>
                        <a href="javascript:void(0);" onClick={() => this.closeModal()}>Close</a>
                    </div>
                </Modal>
            </section>
        );
    }
}

Props

Attribute Required Type description example
visible required Boolean to show or hide the dialog false
effect option String to set how to pop-up fadeInUp, fadeInDown, etc...
width option String to set modal width (px or %) 500, 500px, 80%
height option String to set modal height (px or %) 400, 400px, 50%
onClickAway option Function to set actions when the user click the mask -

Effect

  • fadeInDown [default]
  • fadeInUp
  • fadeInLeft
  • fadeInRight

How To Develop

Setup

$ npm install

Build

$ npm run build

Watch and auto build

$ npm run watch

Test

$ npm test

Docs

$ npm run docs

License

MIT

react-awesome-modal's People

Contributors

geyang avatar putan avatar shibe97 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.