1.0.0 • Published 4 years ago

yimishiji-rodal v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Rodal Build Status Dependency Status NPM downloads

A React modal with animations.
Example

Installation

React 15

npm install yimishiji-rodal --save

Usage

import React from 'react';
import Rodal from 'rodal';

// include styles
import 'rodal/lib/rodal.css';

class App extends React.Component {

    constructor(props) {
        super(props);
        this.state = { visible: false };
    }

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

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

    render() {
        return (
            <div>
                <button onClick={this.show.bind(this)}>show</button>

                <Rodal visible={this.state.visible} onClose={this.hide.bind(this)}>
                    <div>Content</div>
                </Rodal>
            </div>
        )
    }
}

Props

PropertyTypeDefaultDescription
widthnumber400width of dialog
heightnumber240height of dialog
measurestringpxmeasure of width and height
onClosefunc/onClose handler function
visibleboolfalsewhether to show dialog
showMaskbooltruewhether to show mask
showCloseButtonbooltruewhether to show close button
animationstringzoomanimation type
durationnumber300animation duration
classNamestring/className for the container
customStylesobject/custom styles
customMaskStylesobject/custom mask styles

Animation Types

  • zoom
  • fade
  • flip
  • door
  • rotate
  • slideUp
  • slideDown
  • slideLeft
  • slideRight