# @types/react-onclickoutside

> TypeScript definitions for react-onclickoutside

Latest version **6.7.10** (published 2024-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/react-onclickoutside
pnpm add @types/react-onclickoutside
yarn add @types/react-onclickoutside
bun add @types/react-onclickoutside
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.7.10 |
| Published | 2024-02-26 |
| First published | 2016-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/react-onclickoutside
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-onclickoutside
- npm.io page: https://npm.io/package/@types/react-onclickoutside

## Dependencies (1)

- [@types/react](https://npm.io/package/@types/react.md) *

## Recent versions

- 6.7.10 (latest) — 2024-02-26
- 6.7.7 (ts4.5) — 2023-11-07
- 6.7.4 (ts3.7) — 2021-07-07
- 6.7.3 (ts3.2) — 2019-04-26
- 6.0.3 (ts2.6) — 2018-02-12
- 6.0.2 (ts2.5) — 2017-11-09
- 6.0.0 (ts2.1) — 2017-06-02
- 5.7.1 (ts2.0) — 2016-12-30
- 6.7.9 — 2024-01-01
- 6.7.8 — 2023-12-06
- 5.7.12 — 2023-11-07
- 5.7.11 — 2023-10-18
- 6.7.6 — 2023-10-18
- 5.7.10 — 2023-09-27
- 6.7.5 — 2023-09-27
- … 14 more at https://npm.io/package/@types/react-onclickoutside/versions

## README

# Installation
> `npm install --save @types/react-onclickoutside`

# Summary
This package contains type definitions for react-onclickoutside (https://github.com/Pomax/react-onclickoutside).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-onclickoutside.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-onclickoutside/index.d.ts)
````ts
import * as React from "react";

export {};

export interface HandleClickOutside<T> {
    handleClickOutside: React.MouseEventHandler<T>;
}

export interface ConfigObject {
    handleClickOutside?: HandleClickOutside<any>["handleClickOutside"] | undefined;
    excludeScrollbar?: boolean | undefined;
}

export interface InjectedOnClickOutProps {
    disableOnClickOutside(): void;
    enableOnClickOutside(): void;
}
export type WithoutInjectedClickOutProps<P> = Pick<P, Exclude<keyof P, keyof InjectedOnClickOutProps>>;

export interface AdditionalProps extends ConfigObject {
    disableOnClickOutside?: boolean | undefined;
    eventTypes?: string | string[] | undefined;
    outsideClickIgnoreClass?: string | undefined;
    preventDefault?: boolean | undefined;
    stopPropagation?: boolean | undefined;
}

export type ComponentConstructor<P> = React.ComponentType<P>;

export interface ClickOutComponentClass<P> extends React.ComponentClass<P> {
    new(props: P, context?: any): React.Component<P, React.ComponentState> & HandleClickOutside<any>;
}

export type OnClickOutProps<P> = WithoutInjectedClickOutProps<P> & AdditionalProps;

export interface WrapperClass<P, C> {
    new(): WrapperInstance<P, C>;
}

export interface WrapperInstance<P, C>
    extends React.Component<OnClickOutProps<React.JSX.LibraryManagedAttributes<C, P>>>
{
    getInstance(): C extends React.ComponentClass<any> ? InstanceType<C> : never;
}

type PropsOf<T> = T extends (
    props: infer P,
    context?: any,
) => React.ReactElement | null // Try to infer for SFCs
    ? P
    : T extends new(props: infer P, context?: any) => React.Component // Otherwise try to infer for classes
        ? P
    : never;

export default function OnClickOut<
    C extends ComponentConstructor<P> | ClickOutComponentClass<P>,
    P = PropsOf<C>,
>(component: C, config?: ConfigObject): WrapperClass<P, C>;

````

### Additional Details
 * Last updated: Mon, 26 Feb 2024 21:10:43 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [Karol Janyst](https://github.com/LKay), [Boris Sergeyev](https://github.com/surgeboris), and [Thomas Levy](https://github.com/NilSet).

---
_Source: https://npm.io/package/@types/react-onclickoutside · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
