fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.41k stars 678 forks source link

[Feature Request] Group toasts by ID #787

Open magicjeremy opened 2 years ago

magicjeremy commented 2 years ago

The current behavior is to not show a toast with the same ID if one already is visible. However, we have a use case where we still want to group toasts by ID so that they're automatically collapsed by default, but expandable to see each toast. This is useful if there are multiple similar toasts that fit a specific category, but all differ slightly in the metadata.

Another example I've seen this is in this article: https://thenomadprogrammer.com/2020/01/29/grouping-multiple-toast-notifications. It's slightly different because the toasts are paginated, but ideally react-toastify should be flexible enough to allow users to define how they show the toast group.

goldmont commented 1 year ago

It would be great to have also the ability to pass an ID to the useNotificationCenter hook in order to automatically filter notifications. Furthermore, every notification center with the same ID should be internally linked, so a change made to one notification center is also propagated to all the other linked-by-id centers. Thanks