Add asynchronous trigger to Dialog, Collapsible...
- 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
Assessment
This issue has not been assessed yet.