Android — Material 3 JS behaviour

Snackbar

Material’s snackbar slides up from the bottom, its action counts down to four seconds, it queues when you send another, and it clears the FAB instead of covering it.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Delete, then undo

Delete a mail — the snackbar counts down four seconds on its hairline and «Undo» really brings it back. Delete a second one while the first is up: it queues, never stacks.

Inbox

۴ خوانده‌نشده

The inbox is empty — undo!

The bar sits at the inline end of the FAB — 16 px of clear air between them — and inverse-surface keeps it readable over any list.

Important props

Important props
Prop Type Default What it does
duration ms '4000' Four to ten seconds; a hairline layer counts the time left.
action string null One action, on the far side of the text, with no background.
queue behaviour 'sequential' Snackbars queue; they never stack.

Snippet

<div class="m3snk" role="status">
    <span>قالب ذخیره شد</span>
    <button class="m3snk-action">واگرد</button>
</div>

<style>
.m3snk { display: flex; align-items: center; gap: 8px; inline-size: min(100%, 360px);
         padding: 14px 16px; border-radius: 4px; background: #322F35; color: #F5EFF7;
         animation: m3snk-in .3s cubic-bezier(.05,.7,.1,1); }
.m3snk-action { margin-inline-start: auto; color: #D0BCFF; }
</style>