@coxy/react-click-outside
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

React Validator

React tracking click outside children

Need react >=17.0

Example

import React, { useState } from 'react';
import { ReactClickOutside, useToggle } from '@coxy/react-click-outside';

export default () => {
  const [isVisible, open, close] = useToggle(false');

  return (
    <div>

      <ClickOutside visible={isVisible} onClose={close}>
        <div>Popup data</div>
      </ClickOutside>

      <button onClick={open} type="button">
        Open
      </button>

    </div>
  );
};

Api

props:

  • visible [bool]
  • onClose [fn]

/@coxy/react-click-outside/

    Package Sidebar

    Install

    npm i @coxy/react-click-outside

    Weekly Downloads

    7

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    16 kB

    Total Files

    10

    Last publish

    Collaborators

    • dsshard