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

[Snackbar] Add stacking support/display several #1824

Open
f0und3r opened this issue Oct 7, 2015 · 20 comments · May be fixed by #31991
Open

[Snackbar] Add stacking support/display several #1824

f0und3r opened this issue Oct 7, 2015 · 20 comments · May be fixed by #31991
Assignees
Labels
component: snackbar This is the name of the generic UI component, not the React module! new feature New feature or request priority: important This change can make a difference

Comments

@f0und3r
Copy link

f0und3r commented Oct 7, 2015

Summary 💡

Place multiple snack bars on the page.

Examples 🌈

Capture d’écran 2020-09-04 à 15 41 59

Motivation 🔦

Will the material design specification discourages to display multiple snackbar, and could stay the default, display multiple is a common use case:

Only one snackbar may be displayed at a time.

https://material.io/components/snackbars#usage

Benchmark

@thataustin
Copy link

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 ?

@damianobarbati

This comment was marked as outdated.

@oliviertassinari
Copy link
Member

@damianobarbati Do you mean several snackbar on the screen at the same time?
I think that the material specification is discouraging for that use case. An alternative is to dismiss the currently displayed message for a new one.

@damianobarbati
Copy link

@oliviertassinari are you sure about this? :(

@mbrookes
Copy link
Member

mbrookes commented Feb 10, 2017

@damianobarbati LMGTFY: https://material.io/guidelines/components/snackbars-toasts.html "Only one snackbar may be displayed at a time."

@oliviertassinari oliviertassinari added design: material This is about Material Design, please involve a visual or UX designer in the process out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future) and removed new feature New feature or request labels Feb 10, 2017
@iamhosseindhv
Copy link
Contributor

Although guidelines recommend not to stack snackbars, we needed them for our internal use.

So I made this package called notistack. Hope it helps.
You can position and customize it the same way you do for material-ui Snackbars, as all props get passed down to a material-ui Snackbar.
🎉🎉🙂

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 12, 2018

@iamhosseindhv Sweet 😍 ! Do you want to add a link in the documentation?

@iamhosseindhv
Copy link
Contributor

That would be great. 😍 I'll keep working on it to make it more customisable then. 👍🏼

@oliviertassinari oliviertassinari added component: snackbar This is the name of the generic UI component, not the React module! new feature New feature or request and removed out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future) design: material This is about Material Design, please involve a visual or UX designer in the process labels Dec 4, 2019
@oliviertassinari oliviertassinari changed the title Several snackbars on page [snackbars] Support several on page Dec 4, 2019
@oliviertassinari oliviertassinari changed the title [snackbars] Support several on page [Snackbar] Display several on page Dec 4, 2019
@oliviertassinari oliviertassinari added the priority: important This change can make a difference label Dec 19, 2019
@dotmaike
Copy link

@oliviertassinari oliviertassinari changed the title [Snackbar] Display several on page [Snackbar] Add stacking support/display several Sep 4, 2020
@aakash-verma-aurea
Copy link

aakash-verma-aurea commented Sep 21, 2021

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 ..

@zgover
Copy link

zgover commented Sep 22, 2021

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.

@aakash-verma-aurea
Copy link

@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.

@64J0
Copy link

64J0 commented Oct 5, 2021

It would be great if we have the possibility of showing more than one snackbar at a time folks. Let the dev decide what to do.

@ggcaponetto
Copy link

Hi, I ended up building a library for this use case with an imperative API. Check it out!
https://github.com/ggcaponetto/mui-gotit

@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Apr 7, 2022

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.

@yurijmikhalevich
Copy link

@ZeeshanTamboli, hi! 👋 Great news. Are there any updates on this?

@ZeeshanTamboli
Copy link
Member

Hi @yurijmikhalevich . You can follow #31991.

@TheRealCuran
Copy link

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.

@FaabLondon
Copy link

FaabLondon commented Dec 15, 2022

Hello,
thanks for this https://deploy-preview-31991--material-ui.netlify.app/material-ui/react-snackbar/#experimental-api
in which version of mui/lab is it available? It does not seem to be available in 5.0.0-alpha.112
thanks

@g4ngzt4
Copy link

g4ngzt4 commented Feb 3, 2023

It's pretty easy to do yourself without any external libraries: https://codesandbox.io/s/mui-snack-stack-jnrnwq?file=/src/App.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: snackbar This is the name of the generic UI component, not the React module! new feature New feature or request priority: important This change can make a difference
Projects
None yet
Development

Successfully merging a pull request may close this issue.