Notification Bell

A bell button that swings on new notifications with a rolling unread badge.

@spectrumui/notification-bell

Send a notification — the bell swings and the badge springs in with a rolling count

Installation

Login to view commandCreate a free account to access the install command

Usage

import { NotificationBell } from "@/components/spectrumui/notification-bell"
<NotificationBell count={3} onClick={() => console.log("open inbox")} />

API Reference

NotificationBell

Renders a single button element whose aria-label reflects the unread count. The bell swings automatically whenever count increases, and unread changes are announced through a polite live region.

PropTypeDefaultDescription
countnumber0Number of unread notifications. Increases trigger the ring swing and badge animations
maxnumber99Counts above this render as "max+" (99+ by default)
dotbooleanfalseShow a small pinging dot instead of the numeric badge
ringOnMountbooleanfalsePlay the ring swing once when the component mounts
onClickReact.MouseEventHandler<HTMLButtonElement>-Click handler for the bell button
size"sm" | "md" | "lg""md"Visual size of the button
classNamestring-Additional classes merged with the default button styles

Examples

Dot mode and sizes