Skip to content
Thrum

Notification center

A bell with the number of unread notifications that opens a panel of them, grouped into today and earlier, with an unread filter and mark all as read. The data comes in through props, so it works with any feed. For one message that needs no history, use a toast; for a running log of events on a page, an activity feed.

Install

npx shadcn@latest add @thrum-pro/notification-center

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Automatically installs icons bell, check and x from the icon set.

Data shape

Type
type NotificationItem = {
  id: string;
  title: string;
  body?: string;
  time: Date | string; // a Date or an ISO 8601 string
  read: boolean;
};
Sample
const NOTIFICATIONS: NotificationItem[] = [
  { id: "n1", title: "Deploy finished", body: "Northwind web 4.2.0 is live.", time: "2026-12-03T14:56:00Z", read: false },
  { id: "n2", title: "Invoice paid", body: "Acme Corp paid invoice 1042.", time: "2026-12-02T19:00:00Z", read: true },
];

Props

PropTypeDefaultDescription
notificationsreadonly NotificationItem[]RequiredEvery notification, in any order. The panel sorts them newest first and groups them by day.
nowDate–The moment times are measured from. Left out, it is the moment the panel opened.
localestringDefault "en-US"The language of times such as "5 minutes ago" and "yesterday".
titlestringDefault "Notifications"The heading of the panel and the name of the bell.
emptyLabelstringDefault "No notifications"What the list says when there is nothing to show.
onRead(id: string) => void–Called when the reader marks a notification as read, or opens one that is unread.
onReadAll() => void–Called when the reader presses Mark all as read. The button is disabled while nothing is unread.
onOpen(id: string) => void–Called when the reader presses a notification. The panel closes.
onDismiss(id: string) => void–Called when the reader dismisses a notification. Without it, rows have no dismiss button.
openboolean–Whether the panel is open, when the parent holds the state. Use it with onOpenChange.
defaultOpenbooleanDefault falseWhether the panel starts open, when it holds its own state.
onOpenChange(open: boolean) => void–Called when the panel opens or closes.
soundbooleanDefault truePlay the panel's sounds, if the visitor has sound on.
classNamestring–Extra classes for the bell button, a 32 pixel square.

Motion and sound

Motion

  • The panel fades in and grows from 96% to full size over 150 ms, from the corner under the bell, and leaves the same way.
  • The filter's thumb slides between All and Unread with a quick spring.
  • Reduced motion: the panel appears and leaves at once, and the thumb jumps.

Sound

  • A soft rising tone when the panel opens and a falling one when it closes, except when a notification was pressed.
  • A click when a notification is pressed or the filter changes.
  • A rising chime when a notification arrives while the panel is closed. Nothing sounds for the notifications there on first load.
  • A falling sound when a notification is dismissed.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The bell is a button named by the title and the count, as in "Notifications, 2 unread". The badge on it is hidden from screen readers, which hear the name instead.
  • When the count changes, a polite status region says the new count, so a screen reader hears that something arrived.
  • The panel is a non-modal dialog named by its heading. Its groups are sections named Today and Earlier.
  • An unread notification has a dot, a bold title and the word Unread for screen readers, so it does not rest on colour.
  • Each time is a time element with the exact moment in its datetime attribute; the text reads like "5 minutes ago".
  • Row buttons are 28 pixels square and named after their notification, as in "Dismiss: Invoice paid". Long titles wrap; long bodies are cut at two lines.
  • Under a glass material the panel is translucent. Its tint keeps the text at 4.5 to 1 over any page, and every row sits 8 pixels inside the edge.
KeysAction
Enter / SpaceOn the bell: open the panel. Focus moves to the first control inside it.
Tab / Shift TabMove through Mark all as read, the filter, and each notification with its row buttons.
← / →On the filter: switch between All and Unread.
Enter / SpaceOn a notification: open it and close the panel. On a row button: mark it as read, or dismiss it.
EscClose the panel. Focus returns to the bell.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/notification-center.tsx
Packages
@base-ui/react@1.9.0
Brings along
Sound engineButtonSegmented control
Icons
bellcheckx

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor