Snackbars

Snackbars

Snackbars provide brief messages about app processes through a message - typically at the bottom of the screen

Snackbars inform users of a process that an app has performed or will perform. They appear temporarily, towards the bottom of the screen. They shouldn’t interrupt the user experience, and they don’t require user input to disappear.

Snackbars contain a single line of text directly related to the operation performed. They may contain a text action, but no icons. You can use them to display notifications.

Frequency

Only one snackbar may be displayed at a time.

Simple

A basic snackbar that aims to reproduce Google Keep's snackbar behavior.

Customized Snackbars

If you have been reading the overrides documentation page but you are not confident jumping in, here are examples of how you can change the look of a Snackbar.

⚠️ While the material design specification encourages theming, these examples are off the beaten path.

This is an error message!
This is a warning message!
This is an information message!
This is a success message!

Positioned

There may be circumstances when the placement of the snackbar needs to be more flexible.

Message Length

Some snackbars with varying message length.

I love snacks.
I love candy. I love cookies. I love cupcakes. I love cheesecake. I love chocolate.
I love candy. I love cookies. I love cupcakes.
I love candy. I love cookies. I love cupcakes. I love cheesecake. I love chocolate.

Transitions

Consecutive Snackbars

Per Google's guidelines, when a second snackbar is triggered while the first is displayed, the first should start the contraction motion downwards before the second one animates upwards.

Don't block the floating action button

Move the floating action button vertically to accommodate the snackbar height.

Out of my way!

Control Direction

Change the direction of the transition. Slide is the default transition.

Change Transition

Use a different transition all together.

Complementary projects

For more advanced use cases you might be able to take advantage of:

notistack

stars npm downloads

In the following example, we demonstrate how to use notistack. notistack makes it easy to display snackbars (so you don't have to deal with open/close state of them). It also enables you to stack them on top of one another.