Skip to content
Log in

Snack bar styling reference

On this page

A snack bar tells POS users that something has just happened, such as an item added to the cart or an order saved, without stopping what they are doing. It floats at the bottom of the screen and closes itself. Use this reference to style snack bars, following the POS styling API rules.

Where a snack bar appears

Snack bars appear at the bottom of the screen after an action that doesn’t need the user to respond. Each snack bar contains these things:

  • A picture or an icon
  • A line saying what happened
  • At most an action button, an Undo button, and a close button

The buttons on a snack bar are buttons named snack-bar-action and snack-bar-close, and the number on the pictures is a badge named snack-bar-count.

Parts of a snack bar

Part What it is Available from
snack-bar-root The whole notice: the layer over the screen that holds the glow and the bar. v22.0.14
snack-bar-glow The glow behind the bar, spreading from the bottom corner of the screen. v22.0.14
snack-bar-bar The pill that floats at the bottom of the screen, with the fill, corners, and shadow. v22.0.14
snack-bar-media The box holding the stack of pictures before the message, when there are any. v22.0.14
snack-bar-message The icon and the text together. v22.0.14
snack-bar-icon The icon before the text, when there is one. v22.0.14
snack-bar-text The text saying what happened. v22.0.14
snack-bar-count The number on the pictures, when there is one. It is a Badge, so it reads the Badge properties. v22.0.14
snack-bar-action The action button and the Undo button. Each is a Button, so it reads the Button properties. v22.0.14
snack-bar-close The close button, when there is one. It is a Button, so it reads the Button properties. v22.0.14

The Available from column shows the first release that carries the name.

Component properties

Set these on snack-bar-root.

Property What it sets Default Available from
--sc-snack-bar-max-width The widest the message grows before it wraps. 200px v22.0.14
--sc-snack-bar-inset-bottom The room the notice leaves at the bottom of the screen. Where the navigation is a bar at the bottom, the POS sets this to the bar’s height, and a value you set replaces it. 0px v22.0.14

Snack bar examples

Each example is tested against the POS on every change.

“Let the notices’ text run longer.”

```css

[part~=’snack-bar-root’] { –sc-snack-bar-max-width: 320px; } ```

“Give the notices a dark fill with light text.”

```css

[part~=’snack-bar-bar’] { background-color: #1f2933; color: #ffffff; } ```

“Make the action button stand out.”

```css

[part~=’snack-bar-action’] { –sc-button-bg: #0b5394; –sc-button-color: #ffffff; } ```

“Turn the glow off.”

```css

[part~=’snack-bar-glow’] { background: none; } ```

What can’t be styled yet

  • Where the bar sits on the screen, which is the bottom corner, apart from the room it leaves below
  • The stack of pictures, which has no parts of its own yet
  • The blur behind the bar, and how the notice slides in

Retired

None yet.

Was this article helpful?

Was this article helpful?