# Pomax/react-onclickoutside

An onClickOutside wrapper for React components

Repository: https://github.com/Pomax/react-onclickoutside
Canonical: https://ross.abutalabs.com/products/react-onclickoutside
Language: JavaScript
License: MIT
License Family: permissive
Topics: javascript, react, onclick, outsideclick, hoc
Last push: 2025-04-09T01:15:04+00:00

## Health v2 (maintenance only)
Score: 30/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 15, release rhythm 8, longevity 100
- inputs: {"age_days": 4257, "days_push": 512, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1815, forks 185 (observed 2026-08-28T04:05:39.880227+00:00)

## What it is
A React Higher Order Component (HOC) that lets components listen for clicks occurring outside of their own DOM element. It is commonly used to close menus, dropdowns, and popovers when the user clicks elsewhere on the page.

## Use cases
- close a dropdown menu when clicking outside of it
- dismiss a popover or tooltip on outside click
- hide a modal or menu when the user clicks elsewhere on the page
- detect outside clicks for a React component
- wrap a React component with an onClickOutside handler
- handle outside touch or mousedown events in React

## When to choose
- you need a small, focused, battle-tested utility for outside-click detection in React
- you want a HOC that works with both class and stateless functional components
- you need fine-grained control over which events are listened to and which elements are skipped

## When to avoid
- you are not using React
- you prefer modern hook-based solutions like useClickOutside implemented inline
- you need a full UI component library with dropdowns and menus already handling this behavior

## Facets
- artifact type: library
- maturity: maintenance
- function: ui-components, middleware
- domain: frontend, web-development
- platform: browser
- tags: react, hoc, onclickoutside, event-handling, dom, nodejs

## Member repositories
- Pomax/react-onclickoutside (main) score 30

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:39.880227+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:20:37.585963+00:00, confidence not recorded.
  - readme: https://github.com/Pomax/react-onclickoutside (fetched 2026-08-28T04:05:39.880227+00:00, sha 468a7e9dfc6b)
  - registry_npm: https://registry.npmjs.org/react-onclickoutside (fetched 2026-08-29T10:59:31.047266+00:00, sha f74a289908fd)
- Data as of 2026-08-30T08:39:29.467469+00:00.
