Notification bell
A notification bell for any dashboard: the unread count on the icon and, on click, a popup with the notifications — icon, title, message, alarm severity and action button, with mark as read, mark all as read and view all. Live over the platform websocket: new notifications ring the bell instantly, no polling. Six styles on the platform’s Material buttons, from a plain icon to a labeled button. No datasource needed.
Who it’s for
Anyone who builds a dashboard for operators, facility managers or customers and wants them to see platform notifications without leaving it — “did anything happen that needs me?” — the way the bell in the ThingsBoard header works, but placed wherever the dashboard needs it, including dashboards opened in full screen or embedded without the platform header.
What it does
A bell with the unread count; a click opens a popup with the notifications of the signed-in user.
- Six bell styles on the platform’s own Material buttons: icon button (like the header bell), icon only, outlined, filled or raised button with a label and the count inside, and a round filled button (FAB).
- Live. The widget subscribes over the platform websocket (
/api/ws), the same channel the header bell uses. New notifications appear instantly and ring the bell; nothing is polled. The list is loaded before the first click, so the popup opens immediately. - Everything a notification carries: its icon (by type, or the icon set in the notification template), title, message, alarm severity chip (Critical, Major, Minor, Warning), relative time (“2 min”, “3 hr”) with the full date on hover, and the template’s action button — a link or a dashboard state, with the entity passed in the state when the template asks for it.
- Mark as read per notification and Mark all as read. The card leaves at once, without waiting for the server.
- View all opens the notification center (Notifications → Inbox).
- Popup outside the widget. It is not clipped by the widget’s size, aligns to the bell, stays on screen and opens upwards when there is more room above. Closes on a click outside or Esc.
- Loading skeleton, “all caught up” empty state, and a “Reconnecting…” line if the connection drops; it reconnects by itself with backoff and refreshes an expired session token.
- Platform translations for “Notifications”, “Mark all as read”, “View all” and severities.
Limitations: shows the unread notifications of the current user (up to 100 in the popup; the badge counts all of them). Read ones are in the notification center.
How to set up
- Add the widget to a dashboard. No datasource is needed — it uses the signed-in user.
- Size it to the bell: 1.5 × 1.5 grid cells by default; in a header row, give it the row’s height.
- To see notifications, the user needs some: Notifications → Rules / Templates in ThingsBoard, or send one from Notifications → Send notification.
Data keys
| Key | Role | Type | Description |
|---|---|---|---|
| — | — | — | None. The widget reads the user’s notifications over the websocket, not from a datasource. |
With no notifications the badge is hidden and the popup shows “You’re all caught up”. If the connection drops, the last list stays visible with a “Reconnecting…” line.
How to customize
- To change how the bell looks — Bell → Bell style: Icon button, Icon only, Outlined / Filled / Raised button with label, or Round filled button (FAB).
- To change the button — Bell → Button label (empty uses the translated “Notifications”), Button color, Button text and icon color.
- To change the icon — Bell → Icon, Icon color (icon button and icon only).
- To set an exact bell size — Bell → turn off Fit the bell to the widget, then Icon size, px.
- To stop the bell ringing — Bell → Ring when a notification arrives off.
- To show a dot instead of the number — Badge → Badge: Dot only; Badge color, Badge text color.
- To hide the badge — Badge → Show unread badge off.
- To show only some notifications — Popup → Show only these types (for example Alarm and Device activity). Filters the list and the badge.
- To change how many are listed — Popup → Notifications in the popup.
- To resize the popup — Popup → Width, px, Max height, px; Message lines sets how many lines of a message are shown.
- To match your brand — Popup → Accent color (links, buttons, counter, new-notification highlight).
- To rename the popup — Popup → Title; empty uses the platform’s translated “Notifications”.
- To hide the “Go to …” buttons — Popup → Show the action button off. Hides the button a notification template adds, on every notification.
- To remove actions — Popup → Show “Mark all as read”, Show “Mark as read” on each notification, Show “View all”.
Tips
- The widget opens its own lightweight websocket connection, independent of the platform header, so it also works on dashboards opened in full screen where the header bell is hidden.
- Put it in the dashboard’s header layout row with a transparent background (the default) so it looks like part of the header.
- On a toolbar with other buttons, pick the outlined or filled style and give the widget the toolbar’s height: the button follows the widget height between 32 and 56 px.
Share Your Widget with the Community
Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.