All Projects → andreoav → click-outside-hook

andreoav / click-outside-hook

Licence: MIT License
A simple react hook to detect click or touch events outside an element.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to click-outside-hook

reactools
Create React interfaces is easy.
Stars: ✭ 14 (-51.72%)
Mutual labels:  hooks
use-input-mask
use-input-mask.now.sh
Stars: ✭ 17 (-41.38%)
Mutual labels:  hooks
reason-hooks-lib
A set of reusable ReasonReact hooks.
Stars: ✭ 31 (+6.9%)
Mutual labels:  hooks
reactive-hooks
Reactive Hooks Library
Stars: ✭ 29 (+0%)
Mutual labels:  hooks
react-awesome-reveal
React components to add reveal animations using the Intersection Observer API and CSS Animations.
Stars: ✭ 564 (+1844.83%)
Mutual labels:  hooks
AppRun
AppDir runtime components
Stars: ✭ 19 (-34.48%)
Mutual labels:  hooks
use-unmount-signal
A React Hook to cancel promises when a component is unmounted
Stars: ✭ 276 (+851.72%)
Mutual labels:  hooks
react-europe-2019
Slides and demo app from my keynote
Stars: ✭ 29 (+0%)
Mutual labels:  hooks
use-mobile-detect-hook
React hook to detect the device type
Stars: ✭ 62 (+113.79%)
Mutual labels:  hooks
hooks4git
Extensible Hook Management System for GIT
Stars: ✭ 27 (-6.9%)
Mutual labels:  hooks
execmon
Advanced process execution monitoring utility for linux (procmon like)
Stars: ✭ 77 (+165.52%)
Mutual labels:  hooks
rn-chat
Chat app made with React Native, NativeBase, Apollo Hooks and Sequelize.
Stars: ✭ 37 (+27.59%)
Mutual labels:  hooks
rusty-hook
git hook manager, geared toward Rust projects
Stars: ✭ 93 (+220.69%)
Mutual labels:  hooks
tiny-react-with-hooks
⚛︎ Fundamental Implementation of React with Hooks & VDOM
Stars: ✭ 20 (-31.03%)
Mutual labels:  hooks
react-daterange-picker
A react date range picker to using @material-ui. Live Demo: https://flippingbitss.github.io/react-daterange-picker/
Stars: ✭ 85 (+193.1%)
Mutual labels:  hooks
use-metamask
a custom React Hook to manage Metamask in Ethereum ĐApp projects
Stars: ✭ 131 (+351.72%)
Mutual labels:  hooks
modules
Mesos modules examples and open source modules outside of the Apache Mesos source tree.
Stars: ✭ 26 (-10.34%)
Mutual labels:  hooks
react-smart-app
Preconfiguration React + Ant Design + State Management
Stars: ✭ 13 (-55.17%)
Mutual labels:  hooks
Perky
Perky a beautiful animated app concept built with lots of love in React Native.
Stars: ✭ 37 (+27.59%)
Mutual labels:  hooks
max-todos
A basic Todo app developed in React.
Stars: ✭ 19 (-34.48%)
Mutual labels:  hooks

click-outside-hook

A simple react hook to detect click or touch events outside an element and execute a provided callback when this happens.

NPM CircleCI Greenkeeper badge module formats: cjs, and es

Install

yarn add click-outside-hook

Usage

import React from 'react';
import useClickOutside from 'click-outside-hook';

export default function SomeAwesomeComponent() {
  const ref = useClickOutside(() => console.log('my callback'));

  return (
    <div>
      <div ref={ref}>Awesome content</div>
    </div>
  );
}

When the user clicks or touches outside the Awesome content element, the callback is executed.

License

MIT © andreoav

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].