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

react-dialog-modal

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dialog-modal

Dialog component in react

  • 0.3.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

React Dialog

React component for dialog widget.

Installation

React Dialog is available as an npm package.

npm install react-dialog-modal

Use browserify and reactify for dependency management and JSX transformation.

All styles written in CSS and are in css/index.css

Demo

http://mohitgupta8888.github.io/react-dialog-modal

Usage

import Dialog from 'react-dialog-modal'
class Example extends React.Component {
    constructor() {
        super();
        this.state = {
            isDialogOpen: false
        }
    }

    openDialog = () => this.setState({ isDialogOpen: true })

    handleClose = () => this.setState({ isDialogOpen: false })

    render() {
        return (
            <div className="container">
                <button type="button" onClick={this.openDialog}>Open Dialog</button>
                {
                    this.state.isDialogOpen &&
                    <Dialog
                        title="Dialog Title"
                        modal={true}
                        onClose={this.handleClose}
                        buttons={
                            [{
                                text: "Close",
                                onClick: () => this.handleClose()
                            }]
                        }>
                        <h1>Dialog Content</h1>
                        <p>More Content. Anything goes here</p>
                    </Dialog>
                }
            </div>
        );
    }
}

API

props.height
  • Number
  • default: "auto"
  • Whether overlay is added to dialog or not
props.width
  • Number
  • default: false
  • Whether overlay is added to dialog or not
props.modal
  • Boolean
  • default: false
  • Whether overlay is added to dialog or not
props.isDraggable
  • Boolean
  • default: false
  • Whether dialog is draggable
props.isResizable
  • Boolean
  • default: false
  • Whether dialog is resizable
props.title
  • String or Element
  • default: ''
  • This property
props.onClose
  • Function
  • default: null
  • Set a function that will be triggered whenever there is a close event.
props.closeOnEscape
  • Boolean
  • Default: false
  • If true, the props.onClose event will be triggered if user presses Esc key on keyboard.

License

MIT

Keywords

FAQs

Package last updated on 02 Aug 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

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