1.1.0 • Published 5 years ago

use-toggle-and-outclick v1.1.0

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

use-toggle-and-outclick

React hook for controlling the state of any dropdowns that need an outclick for closing

Install

yarn add use-toggle-and-outclick

Usage

import useToggleAndOutClick from 'use-toggle-and-out-click';

const ExampleControl = () => {
  const [isDropOpened, dropRef, toggleDrop, closeExplicitly] = useToggleAndOutClick();
  /**
  * isDropOpened - state field weather the dropdown is open now
  * dropRef - ref for dropdown dom-node (ref={dropRef})
  * toggleDrop - function that toggles state
  * closeExplicitly - function that closes dropdown
  */

  // ...
};

Examples

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago