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
Example
Action buttons
Action buttons
Example
Direction & offset
Direction & offset
Example
Stack limit
Stack limit 3
At most 3 snackbars are shown at once; when a 4th appears, the oldest one receives oas-close.
Example
API
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
action-text | Action button text | string | — |
direction | Position direction | — | — |
duration | Auto-dismiss duration (ms) | string | 4000 |
message | Message text | string | — |
offset | Offset from the screen edge (px) | string | 24 |
open | Whether shown (controlled) | boolean | — |
Events
| Event | Description |
|---|---|
oas-action | Dispatched when the action button is clicked |
oas-close | Dispatched when auto-dismissing after timeout (controlled mode does not clear open itself) |
oas-open | Dispatched when opened |
role="status"withoutaction-text;role="alertdialog"+aria-live="assertive"when an action button is present.openis controlled: onlyoas-closeis dispatched on timeout and the host is responsible for removingopen; at most 3 stack at once, and the oldest receivesoas-closewhen exceeded.