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.
Default
With notifications and with an empty list.
Code
Controlled
Mark items as read, mark all as read and clear the list.
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 item is clicked. |
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. |