-
Notifications
You must be signed in to change notification settings - Fork 340
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
Support multiple <Toaster> elements #158
Comments
Hi @mrmiguu! Great suggestion - considered this for v2, but decided not to do it atm. Let's use this issue to see how the demand is. 👍 |
This would be super helpful. |
Please, consider, would be amazing feature |
…s by id # What `<Toaster>` and `toast()` currently have no way of communicating distinctly if there exists multiple Toaster elements throughout. Add a way for toast calls to "pop up" exclusively from any specific Toaster # Changes Add `toasterId` to `<Toaster>` props Add `toasterId` to all `toast*()` calls under the `options?` arg
#159 This PR, if merged, essentially works like this: toast('hello', { toasterId: 'unique-id-here' })
...
<Toaster toasterId="unique-id-here" /> This way, only that Toaster will be able to receive |
looking forward to having this! |
hi all, |
This would be an extremely valuable feature! Please consider adding. |
Yeah. That is what we need right now. For now we will have to support a different functionality with the same behavior. |
My guess is that this doesn't use React Context yet. If there could be something like a I also noticed that it doesn't work out-of-the-box when you have a component library (in a different package) and want to toast things from there to the main app. A context could make that really easy, but for now I just passed the |
Any updates on this? |
pls ser? |
This would be an extremely valuable feature! |
+1, would definitely be helpful. Having to do some workarounds right now to get toasts to work with headless UI dialogs. |
Please consider this feature :) |
This would be a great feature,hands down |
would love to have this feature as well |
+1 |
Any news? It would be a great feature. |
1 similar comment
Any news? It would be a great feature. |
Just wanted to add my interest in this feature |
need this too |
Any news on this? Been a while, would be an amazing feature to have 🤌 |
I think the owner is not quite available to manage the repo, we have many pending pull requests, few months ago I was needing a feature, I sent a pull request and it's still pending, so I've forked the repo, implemented the feature that I was needing, and sent to NPM, temporary solution. |
I started a PR (#383) for this! You can follow along there. 🎉 The WIP docs + demo can be viewed here: https://react-hot-toast-git-multi-toaster-timos-team.vercel.app/docs/multi-toaster Edit: I just published v2.6.0-beta.0, which adds support for multiple toasters. You can give it a try with npm i react-hot-toast@beta. Testers and feedback are much appreciated. Try it out: |
This might be outside of the scope for this project, but the ability to have multiple
<Toaster>
elements on a page (wheretoast()
calls could have aToasterID
passed in) would be pretty cool and add a lot flexibility.Example:
The text was updated successfully, but these errors were encountered: