Moey extras
Notification center
A bell with an unread count that opens your notifications. Write the list in HTML — Moey keeps the count, the read state and the times up to date.
Notifications
- Today
- AKAna Kim commented on order #10421: “Can this ship by Friday?”
- Payment received $129.00 from Max Ruiz
- Order #10418 shipped Tracking is on its way to the customer.
- LTLena Torres mentioned you in Returns
- Earlier
- Card declined Order #10402 needs a new payment method.
- Sam Okafor joined your team
- New review ★★★★★ on Moey Mug
You're all caught up.
<button class="btn btn-gray btn-ghost btn-icon" data-moey-open="#inbox" aria-label="Notifications">
<i class="mi mi-bell"></i><span class="badge badge-corner"></span> <!-- the count fills itself in -->
</button>
<div class="popover notifications" id="inbox" data-moey-placement="bottom-end">
<div class="notifications-header">
<h3 class="notifications-title">Notifications <span class="badge badge-red badge-subtle" data-moey-unread-count></span></h3>
<button class="btn btn-link btn-sm" data-moey-mark-all>Mark all as read</button>
</div>
<div class="notifications-toolbar">
<div class="btn-group btn-group-segmented btn-group-sm" role="group" aria-label="Show">
<button class="btn active" aria-pressed="true" data-moey-filter-notifications="all">All</button>
<button class="btn" data-moey-filter-notifications="unread">Unread</button>
</div>
</div>
<ul class="notifications-list">
<li class="notifications-group">Today</li>
<li class="notification is-unread">
<span class="avatar avatar-sm avatar-pink">AK</span>
<a class="notification-content" href="/orders/10421">
<span class="notification-title">Ana Kim</span> commented on order #10421
<time class="notification-time" datetime="2026-11-22T09:40">9:40</time>
</a>
</li>
<li class="notification">
<span class="notification-icon theme-green">
<i class="mi mi-credit-card"></i>
</span>
<div class="notification-content">
<span class="notification-title">Payment received</span>
$129.00 …
</div>
</li>
</ul>
<div class="notifications-empty">
<i class="mi mi-bell-off"></i>
You're all caught up.
</div>
<div class="notifications-footer">
<a class="btn btn-gray btn-ghost btn-sm" href="/notifications">View all</a>
</div>
</div>
- The count on the bell (any
.badge-cornerinside the button) and in[data-moey-unread-count]follows the unread items, and hides at zero. Screen readers hear "Notifications, 3 unread". - Clicking a notification marks it read (a link still opens). Hover or focus one for ✓ (read / unread) and ✕ (dismiss) — added for you.
data-moey-mark-allmarks everything read;data-moey-filter-notifications="unread"buttons switch the view. Group headings hide when they have nothing to show, and.notifications-emptyappears when the list is empty.- A
<time class="notification-time" datetime="…">reads "Just now", "5m ago", "Yesterday"… and stays fresh. Hover it for the exact date. - It's a list, like a menu: a click outside closes it (unlike forms in popovers).
Add from code
Moey.notify() adds one at the top — newest first, under the first group (or the one you name). Add toast: true to also show it as a toast.
Moey.notify('#inbox', {
title: 'Max Ruiz',
text: 'placed order #10422',
avatar: 'MR', theme: 'cyan', // or icon: 'package' (with theme)
href: '/orders/10422',
time: Date.now(), // any date; default now
group: 'Today', // optional
toast: true, // also show a toast
});
As a page
Without .popover it’s a plain block — for a full "All notifications" page. Add .notifications-page for a card look.
All notifications
- AKAna Kim commented on order #10421: “Can this ship by Friday?”
- Payment received $129.00 from Max Ruiz
- Order #10418 shipped Tracking is on its way to the customer.
Nothing here yet.
<div class="notifications notifications-page">
<div class="notifications-header">…</div>
<ul class="notifications-list">…</ul>
</div>
Colors
The unread dot and highlight follow theme-<color> on the panel; icons take their own color.
<div class="popover notifications theme-purple" id="inbox">…</div>
Events
inbox.addEventListener('moey:read', (e) => save(e.detail.item, e.detail.read)); // item is null for "mark all"
inbox.addEventListener('moey:dismiss', (e) => { // cancelable
if (!confirm('Dismiss?')) e.preventDefault();
});
inbox.addEventListener('moey:notify', (e) => e.detail.item); // after Moey.notify()
| Class / attribute | What it does |
|---|---|
.popover.notifications + data-moey-open | The panel and its bell (any popover placement works) |
.notification · .is-unread | One notification · a new one (dot + tint) |
.notification-icon / .avatar · .notification-content (a link or button makes the whole row clickable) | The picture · the text |
.notification-title · .notification-text · .notification-time · .notification-body | Name / headline · second line · "5m ago" · extra content |
.notifications-group · .notifications-empty · .notifications-footer · .notifications-toolbar | Headings · nothing-left message · bottom link · filter row |
data-moey-unread-count · data-moey-count="#inbox" | Elements that show the unread number (inside / anywhere) |
data-moey-mark-all · data-moey-filter-notifications | Mark all read · "all" / "unread" view |
data-moey-actions="false" · data-moey-close-outside="false" | No ✓ / ✕ buttons · don't close on an outside click |
.notifications-page | A full page of notifications (no popover) |