iamhosseindhv / notistack

Highly customizable notification snackbars (toasts) that can be stacked on top of each other
https://notistack.com
Other
3.89k stars 299 forks source link

[help] How can I make new snackbar always appears at the start position instead of at the rear? #578

Open Paper-Folding opened 1 year ago

Paper-Folding commented 1 year ago

I noticed that new snackbar appears at the rear of the stack, how can I make new snackbar always appears at the beginning position? For example, if setting up snackbar at left bottom position, how can I make new snackbar appears the very bottom of all snackbars rather than at the top?

Paper-Folding commented 1 year ago

For example, it should behave just like this one I used before: https://paper-folding.github.io/toastify/ .

TimonPeng commented 8 months ago

notistack-SnackbarContainer has style flex-direction: column-reverse by default.

Add a new class name snackbar-container:

<SnackbarProvider
  classes={{ containerRoot: "snackbar-container" }}
  anchorOrigin={{ horizontal: "right", vertical: "bottom" }}
  maxSnack={Infinity}
>
  <Component {...pageProps} />
</SnackbarProvider>

Set css for snackbar-container or use default class name notistack-SnackbarContainer.

.snackbar-container {
  flex-direction: column;
}