Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add close feature to Dialog #2819

Open
rahmatulloh19 opened this issue Apr 7, 2024 · 4 comments
Open

Add close feature to Dialog #2819

rahmatulloh19 opened this issue Apr 7, 2024 · 4 comments

Comments

@rahmatulloh19
Copy link

Feature request

Overview

Hello Radix UI programmers. I would have asked you, please if you add the option to optionally close to the "Dialog" component. I mean closing the component without any setstates.

Examples in other libraries

https://ant.design/components/modal#modalmethod in this link showed the onCancel function with this function we can close the modal ourselves

@FredrikMWold
Copy link

Radix dialog has a component called Dialog.Close that will close the dialog as long as its used within Dialog.Root:

<Dialog.Close>
    Close
</Dialog.Close>

Would that solve yout issue?

@rahmatulloh19
Copy link
Author

I'm sorry, but it didn't help me. The modal must be closed after the work on my asynchronous function is completed.

It works exactly when I click on this CLOSE in the solution you said, For me, the function must be closed when it is finished

@FredrikMWold
Copy link

Then it sounds like you are trying to do something react wasnt made for. Closing the modal is a ui change and since the ui is a function of state. You have to change some state to change the ui.

Why so you need to close the modal without any setStates?

@s97712
Copy link

s97712 commented Apr 24, 2024

#2864
I think this could be the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants