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

[Feature]: Toast: Support immediately removing a toast #32887

Open
1 task done
WanderG opened this issue Sep 23, 2024 · 1 comment
Open
1 task done

[Feature]: Toast: Support immediately removing a toast #32887

WanderG opened this issue Sep 23, 2024 · 1 comment

Comments

@WanderG
Copy link

WanderG commented Sep 23, 2024

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

When dismissing a toast, an animation is used, making it slow to dismiss multiple toasts.
We would like to be able to more quickly close a few toasts.

I have found a workaround that cannot be used in production, as the types do not support it, and presumable only happens to work by accident. But it demonstrates what I want:
https://stackblitz.com/edit/jcm3kt-k6affw?file=src%2Fexample.tsx

I can see a few possible solutions:

  1. Allow customizing/removing the animation
  2. Update the ToastChangeData type to support the remove method (as used in the example)
  3. Add options to the dismissToast function returned by useToastController, to allow immediately removing the toast

Of these 3 options (but I'm sure there are more), I'd prefer the 3rd, as it would allow me to only immediately remove the toast on user-interaction, while keeping the animation when a toast is removed after a timeout.

toast-quick-close

Have you discussed this feature with our team

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Priority

Normal

@miroslavstastny
Copy link
Member

We should add motion slot to Toast component.

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

No branches or pull requests

5 participants