Alert & banner
Messages inside the page (alerts) and across the top of it (banners). A button with data-momo-dismiss removes them.
Alert
An .alert-icon tile, an .alert-body with an .alert-title and a line of text, and an optional dismiss button. Use role="alert" only for urgent messages that appear while someone works; use role="status" for calm ones.
Momo 0.1 adds kanban and calendar.
<div class="alert" role="status">
<span class="alert-icon"><i class="mi mi-info"></i></span>
<div class="alert-body"><b class="alert-title">New version available</b><p>Momo 0.1 adds kanban and calendar.</p></div>
<button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-dismiss aria-label="Dismiss"><i class="mi mi-x"></i></button>
</div>Colors
.alert-<color> fills it; .alert-<color>-soft is a quiet tint with a colored icon tile.
Maintenance tonight. Expect downtime around 2 AM.
Q2_Sales_Report.csv is ready to download.
The card ending in 4340 was declined. Try another card.
<div class="alert alert-yellow" role="alert">
<span class="alert-icon"><i class="mi mi-triangle-alert"></i></span>
<div class="alert-body"><b class="alert-title">System alert</b><p>Maintenance tonight. Expect downtime around 2 AM.</p>
<div class="alert-actions"><a class="btn btn-sm" href="#">View details</a></div></div>
<button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-dismiss aria-label="Dismiss"><i class="mi mi-x"></i></button>
</div>
<div class="alert alert-green-soft" role="status">
<span class="alert-icon"><i class="mi mi-circle-check"></i></span>
<div class="alert-body"><b class="alert-title">Export complete</b><p>Q2_Sales_Report.csv is ready to download.</p></div>
</div>
<div class="alert alert-red-soft" role="alert">
<span class="alert-icon"><i class="mi mi-circle-alert"></i></span>
<div class="alert-body"><b class="alert-title">Payment failed</b><p>The card ending in 4340 was declined. Try another card.</p>
<div class="alert-actions"><button class="btn btn-sm btn-red" type="button">Update card</button><button class="btn btn-sm btn-ghost" type="button">Later</button></div></div>
</div>
<div class="alert alert-violet-soft alert-sm" role="status">
<span class="alert-icon"><i class="mi mi-sparkles"></i></span>
<div class="alert-body">Tip: press <kbd>Ctrl</kbd> + <kbd>K</kbd> to search anything.</div>
</div>.alert-sm is a one-line version.
Banner
.banner is a full-width strip, usually at the very top of the app. Black by default; .banner-brand or .banner-<color> to color it.
<div class="banner" role="status">You're on the free plan. <a href="#">Upgrade for 50% off</a>
<button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-dismiss aria-label="Dismiss"><i class="mi mi-x"></i></button></div>
<p></p>
<div class="banner banner-yellow" role="status"><i class="mi mi-wrench"></i> Scheduled maintenance Saturday 2 AM to 4 AM.</div>Dismissing
A button with data-momo-dismiss fades out and removes the closest .alert or .banner (or the element in data-momo-dismiss="#id"). It fires momo:dismiss first, so you can remember the choice.
document.addEventListener('momo:dismiss', (e) => localStorage.setItem('hide-' + e.target.id, '1'));