mui / mui/base-ui

Add asynchronous trigger to Dialog, Collapsible...

Open
#4,260 5 comments 1 reaction 0 assignees View on GitHub
component: dialog type: new feature
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

## Summary

ad prop to `` or `` to await triggering closing a dialog upon success

## Examples

```tsx
function SaveDialog() {
const mutation = useMutation({
mutationFn: (data) => saveData(data),
});

return (

Open Dialog





Confirm Changes


Are you sure you want to proceed with this update?



Cancel

mutation.mutateAsync()}
className="confirm-button"
>
Confirm






);
}
```
## Motivation

The dialog like components where there is a `` or similar, can only handle syncronous events.
I would like a variation like `` to handle scenario where
user open a dialog, the footer has a button that does trigger an async action e.g. "Save" and then close the dialog upon success, and I don't have to add `useState` to control it to have a cleaner component composition.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.