Display
NotificationBell
Bell button with an unread badge that opens a notification center, designed for app shell headers.
<script>
import { NotificationBell } from "@codeatlasdev/ui";
</script>
<NotificationBell notifications={items} onRead={markRead} onReadAll={markAll} onClear={clear} />
The unread count is derived from notifications where read is falsy. The component is controlled: update your list in onRead, onReadAll and onClear. Every visible string can be replaced through labels. The panel is a popover layer anchored below the bell, aligned to its end edge, and closes on Escape or an outside press.
Default
With notifications and with an empty list.
Reference #132 · Pick in the gallery
Code
Controlled
Mark items as read, mark all as read and clear the list.
Reference #131 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
notifications | NotificationItem[] | [] | Items shown in the panel: `{ id, title, body?, time?, read?, variant? }`. `variant` is `'default' | 'info' | 'success' | 'warning' | 'error'`. |
onRead | (id: string) => void | undefined | Called when an unread item is clicked. Items already read do not call it. |
onReadAll | () => void | undefined | Called by the mark all as read action. |
onClear | () => void | undefined | Called by the clear action. |
labels | { title?, markAll?, clear?, empty? } | {} | String overrides for i18n. |
class | string | '' | Extra class names. |
children | Snippet | undefined | Custom trigger content. |