-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Snackbar] Add stacking support/display several #1824
Comments
Not to redirect the question... but is there a way to specify the placement of the snackbar? I noticed the example puts it in the bottom center of the page, but it always show up bottom left for me. That might be what you're asking as well, @f0und3r ? |
This comment was marked as outdated.
This comment was marked as outdated.
@damianobarbati Do you mean several snackbar on the screen at the same time? |
@oliviertassinari are you sure about this? :( |
@damianobarbati LMGTFY: https://material.io/guidelines/components/snackbars-toasts.html "Only one snackbar may be displayed at a time." |
Although guidelines recommend not to stack snackbars, we needed them for our internal use. So I made this package called notistack. Hope it helps. |
@iamhosseindhv Sweet 😍 ! Do you want to add a link in the documentation? |
That would be great. 😍 I'll keep working on it to make it more customisable then. 👍🏼 |
|
Having only one snackbar displayed at a time is stupid. Leave it to the dev and UX on how many make sense, but there are an infinite number of instances, where two or more notifications come up at the same time with different priorities and importance for a given user and we cannot afford to delay and show them one by one. Just going for react-toastify .. |
@aakash-verma-aurea the intention of single display for snackbar is to adhere to the Material Design guidelines. This change would be a deviation to Material Design and specifically doing the exact example provided of what not to do. However, with that being said I am in favor of this deviation so long that it is opt-in only. For those cases it is best to adhere to the guidelines such as mobile devices with limited real estate this could potentially block interaction when they fill the screen. |
@zgover I totally understand and I'm blaming nothing but the guidelines. Opt-in totally works. One cannot have the same guidelines for all screen sizes as then devices at both ends of the spectrum(mobile vs laptops) suffer in one way or the other. |
It would be great if we have the possibility of showing more than one |
Hi, I ended up building a library for this use case with an imperative API. Check it out! |
PR opened for this at #31991 . We will be releasing it under MUI Lab initially. Demo preview: https://deploy-preview-31991--material-ui.netlify.app/material-ui/react-snackbar/#experimental-api. We will be polishing the demos further. |
@ZeeshanTamboli, hi! 👋 Great news. Are there any updates on this? |
Hi @yurijmikhalevich . You can follow #31991. |
Yes, please! You have my 👍 (bonus points if I can configure which "type" can be stacked and which not. Ie. I want errors stacked but infos/successes only replacing each other. |
Hello, |
It's pretty easy to do yourself without any external libraries: https://codesandbox.io/s/mui-snack-stack-jnrnwq?file=/src/App.tsx |
Summary 💡
Place multiple snack bars on the page.
Examples 🌈
Motivation 🔦
Will the material design specification discourages to display multiple snackbar, and could stay the default, display multiple is a common use case:
https://material.io/components/snackbars#usage
Benchmark
The text was updated successfully, but these errors were encountered: