Skip to content

eFounders/react-click-outside

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClickOutside

React click outside component.

Installation

$ npm install folkapp/react-click-outside

Props

ClickOutside takes two props:

  • onClickOutside (required): function that closes the <ClickOutside /> element
  • exceptions: an array of references on which we don't want the click outside event to be triggered

Example

<div
  ref={(ref) => this.setState({except: ref})}
  onClick={handleOpening}
>
  Open the menu or something
</div>
<ClickOutside
  onClickOutside={::this.close}
  exceptions={[this.state.except]}
>
  <p>Im a menu or something that you want to hide when clicking outside.</p>
</ClickOutside>

Badges


tjholowaychuk.com  ·  GitHub @tj  ·  Twitter @tjholowaychuk

About

ClickOutside component for React.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.1%
  • HTML 3.5%
  • CSS 1.7%
  • Makefile 0.7%