Next.js Discord

Discord Forum

close nextui modal

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hey i want to close this next ui modal but in the same function i want to execute some other code. (send button)
But how can i do it?

(Form Template)
https://nextui.org/docs/components/modal#with-form
const { isOpen, onOpen, onOpenChange } = useDisclosure();

async function handleButtonSend() {
    // here i want to close the modal
    // and do some other things ..
}

<Modal
    isOpen={isOpen}
    onOpenChange={onOpenChange}
    placement="top-center"
>
    <ModalContent>
        {(onClose) => (
            <>
              ...
                <ModalFooter>
                    <Button color="danger" variant="flat" onPress={onClose}>
                        Close
                    </Button>
                    <Button color="primary" onPress={handleButtonSend}>
                        Send
                    </Button>
                </ModalFooter>
            ...
</Modal>

0 Replies