Chakra Ui provides disclosure
const { isOpen, onOpen, onClose } = useDisclosure();
and in the documentation this button will close the drawer
<Button variant="outline" mr={3} onClick={onClose}>
Cancel
</Button>
they haven't provided something like close() function to close it programmatically, or am i missing something
onClose
is function provided from chakra-ui which will close the drawer or any portal created opened by chakra-ui. onClose
behaves like close() function only.