# solid-outside-click-handler

> Detect and handle clicks outside a Solid component.

Latest version **0.1.0** (published 2022-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install solid-outside-click-handler
pnpm add solid-outside-click-handler
yarn add solid-outside-click-handler
bun add solid-outside-click-handler
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2022-07-15 |
| First published | 2022-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Dirag Biswas |
| Maintainers | diragb |
| Keywords | detect, outside, click, solid, ui, typescript |

## Links

- npm: https://www.npmjs.com/package/solid-outside-click-handler
- Repository: https://github.com/diragb/solid-outside-click-handler
- Homepage: https://github.com/diragb/solid-outside-click-handler#readme
- Issues: https://github.com/diragb/solid-outside-click-handler/issues
- Funding: https://github.com/sponsors/diragb
- npm.io page: https://npm.io/package/solid-outside-click-handler

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2022-07-15

## README

# solid-outside-click-handler

[![npm](https://img.shields.io/badge/npm-solid--outside--click--handler-brightgreen.svg?style=flat-square)](https://www.npmjs.com/package/solid-outside-click-handler)
[![npm version](https://img.shields.io/npm/v/solid-outside-click-handler.svg?style=flat-square)](https://www.npmjs.com/package/solid-outside-click-handler)
[![npm downloads](https://img.shields.io/npm/dm/solid-outside-click-handler.svg?style=flat-square)](https://www.npmjs.com/package/solid-outside-click-handler)
[![sponsors](https://img.shields.io/github/sponsors/diragb)](https://github.com/sponsors/diragb)

Detect and handle clicks outside a Solid component.

# Usage

## Installation

```bash
npm install solid-outside-click-handler --save
yarn add solid-outside-click-handler ## or in yarn
```

## Example

### Using the HOC
```tsx
import { Component } from 'solid-js'
import { OutsideClickHandler } from 'solid-outside-click-handler'


const Page: Component = () => (
  <OutsideClickHandler
    onOutsideClick={ () => console.log('Outside!') }
  >
    <div>Hello ✨</div>
  </OutsideClickHandler>
)
```

### Using the hook
```tsx
import { Component, onMount } from 'solid-js'
import { useOutsideClickHandler } from 'solid-outside-click-handler'


const Page: Component = () => {
  let ref

  onMount(() => {
    useOutsideClickHandler(ref, () => console.log('Outside!'))
  })

  return (
    <div ref={ ref }>Hello ✨</div>
  )
}
```

# License
MIT

---
_Source: https://npm.io/package/solid-outside-click-handler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
