Material Design Lite
Banner
Bottom sheet
Date picker
Expansion Panel
Image list
Grid list
Menu
Ripple
Select
Stepper
Sort header
Tree
View on Material.io

Preview

Default snackbar with action

Installation

To import just the component styles, copy the following into your project’s styles.css file:

/* Core Styles */
@import url('https://kherrick.github.io/material-design-lite/css/core.css');
/* Material Icons */
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
/* Roboto Font */
@import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap');
/* Component Styles */
@import url('https://kherrick.github.io/material-design-lite/css/components/snackbar/style.css');

Usage

Start with a div element and add the snackbar class name:

<div class="snackbar"></div>

Then add a span element with the message:

<div class="snackbar">
  <span>Default snackbar with action</span>
</div>

To add an action button, add a button element with the text class name:

<div class="snackbar">
  <span>Default snackbar with action</span>
  <button class="text">Action</button>
</div>

Variants

Default

Default snackbar styling.

Default snackbar with action
<div class="snackbar">
  <span>Default snackbar with action</span>
  <button class="text">Action</button>
</div>

Design Tokens

TokenDescriptionDefault
--md-sys-comp-snackbar-container-widthThe width of the container344px
--md-sys-comp-snackbar-background-colorThe background color of the container
--md-sys-comp-snackbar-colorThe foreground color of the container

Resources

Playground

See the Pen Snackbar by Rody Davis (@kherrick ) on CodePen.