@codecraftkit
Documentation
The ClickOutside is a component used to call and actions when the user clicks outside this component children.
it can be imported from the core.
import { ClickOutside } from "@codecraftkit/core";
or alone.
import ClickOutside from "@codecraftkit/clickoutside";
function MyApp() {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 colorScheme="blue" onClick={onOpen}>Open Box</Button>}</>}
children
Component
yes
The body of the ClickOutside
handleAction
Function
yes
The callback when the user click outside