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

react-popups

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-popups

Reactjs component for spawning custom popups at mouse position.

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

react-popups

Install

npm install react-popups

Demo

Read the example code, or run it

git clone git@github.com:Radivarig/react-popups.git
npm install
npm run dev 

navigate to localhost:8080

Features

  • create custom popup components on event ('click', 'contextMenu', ..)
  • pass data to them
  • detect screen quadrant (safe to click near edges)
  • close all front popups on click

Basic Usage

// ...
var Popups = require('react-popups')

var PopupHandler = React.createClass({
  render: function() {
    console.log('received: ', this.props.data.nodeValue) // received: clicked element identifier
    var Popup = <DefaultPopup/>
    switch(this.props.data.nodeValue) {
      case 'clicked element identifier': Popup = <SomePopup/>; break
      // ...
    }
  }
  return ({Popup})
})

var App = React.createClass({
  render: function() {
    return (
      <div>
        {/*Popups will pass event.target[data] as data to handler*/}
        <Popups handler={PopupHandler} data={'attributes.data-yourdata'} event='click'/>
        Some <a data-yourdata={'clicked element identifier'} href='#'>demo</a> text.
      </div>
    )
  }
})

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

License

MIT

Keywords

FAQs

Package last updated on 04 Jul 2015

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