New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gorangajic/react-outside-click

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gorangajic/react-outside-click

React component to track clicks that happened outside of it.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

React Outside Click

React component to track clicks that happened outside of it. You just wrap the components you want to track if a click happened outside and ReactOutsideClick will execute a callback that you defined.

Demo

How to install

npm install react-outside-click

How to use

Import the component to your project and then wrap the nodes you want to track if an outside click happened. Example:

var React = require('react');
var OutsideClick = require('react-outside-click');

React.createClass({
  onOutsideClick: function (event) {
    console.log('click happened outside', event);
  },

  render: function () {
    var styles = {
      elem: {
        width: '100px',
        height: '50px',
        backgroundColor: '#F00',
      },
    };
    return (
      <div>
        <OutsideClick onOutsideClick={this._handleOutsideClick}>
          <div style={styles.elem}>Click here</div>
        </OutsideClick>
      </div>
    );
  }
});

Properties

Property nameDescription
componentString. The component that will wrap all the children. Default: div
onOutsideClickFunction. Callback that will be called with the event object when an outside click happened.
useCaptureBoolean. If true, the internal logic of this component will use the capture phase. Default: false

LICENSE

BSD-3

Keywords

FAQs

Package last updated on 23 Oct 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