Skip to content

Snackbar

A lightweight feedback bar that slides in from the bottom (or top). The open attribute is controlled; it can include an action button and dispatches oas-close after 4 seconds by default, leaving dismissal to the host.

Basic usage

Controlled open

Open

Action buttons

Action buttons

Open (with undo)

Direction & offset

Direction & offset

Bottom (default)TopBottom + offset 80

Stack limit

Stack limit 3

Fire four

At most 3 snackbars are shown at once; when a 4th appears, the oldest one receives oas-close.

API

Attributes

AttributeDescriptionTypeDefault
action-textAction button textstring
directionPosition direction
durationAuto-dismiss duration (ms)string4000
messageMessage textstring
offsetOffset from the screen edge (px)string24
openWhether shown (controlled)boolean

Events

EventDescription
oas-actionDispatched when the action button is clicked
oas-closeDispatched when auto-dismissing after timeout (controlled mode does not clear open itself)
oas-openDispatched when opened
  • role="status" without action-text; role="alertdialog" + aria-live="assertive" when an action button is present.
  • open is controlled: only oas-close is dispatched on timeout and the host is responsible for removing open; at most 3 stack at once, and the oldest receives oas-close when exceeded.