clickoutside
Made with create-react-library
Install
npm install --save @cc-test2/clickoutside
Usage
import React, { Component } from 'react'
import {Box, Button, Code, Grid, Text, useDisclosure} from "@chakra-ui/core";
import ClickOutside from "@cc-test2/clickoutside";
const ExampleComponent = () => {
const {isOpen, onOpen, onClose} = useDisclosure();
return (
<>
{
isOpen ?
<ClickOutside handleAction={onClose}>
<Box rounded='md' bg='red.400' color='white' p={4}>
Click outside this button to close it</Box>
</ClickOutside> :
<Button variantColor={'blue'} onClick={onOpen}>Open Box</Button>
}
</>)
}
License
MIT © CodeCraft