Notification Bell React component for Tailwind CSS v4
v1.0.1Updated in 1.2.1
A React notification bell with an iOS-style unread badge that rolls its digits on new alerts.
Press plus to add a notification, minus to clear one. The bell swings when one lands, its clapper lagging behind, and the count rolls to the new number digit by digit. Add a few fast and it swings harder. Past the max the badge reads 99+, and it shrinks away at zero.
Notification Bell is a free React component in the React feedback components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add notification-bell, together with Motion presets and UIProvider and the npm packages motion and @radix-ui/react-slot.
Add to a project
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add notification-bellUsage
Import NotificationBell from @/components/ui/notification-bell.
import { NotificationBell } from "@/components/ui/notification-bell"
export function Demo() {
return <NotificationBell count={8} />
}
// or wrap it in your own menu trigger (shadcn dropdown-menu):
// <DropdownMenuTrigger asChild>
// <NotificationBell count={unread} />
// </DropdownMenuTrigger>Props
countdefault0numberUnread total on the badge. The badge is hidden at 0, and fractional or negative values are floored to it.
maxdefault99numberHighest number shown. Anything above it displays as the max followed by a plus.
variantdefault"count""count" | "dot"Whether the badge shows the number or a plain dot. The dot appears and leaves on the same counts.
sizedefault48numberDiameter of the button in pixels. The bell, badge, and digits are all fractions of it. Below 44px the button keeps a 44px hit area on touch screens.
colordefault"red""red" | "orange" | "green" | "blue" | "violet" | stringBadge color: a name from the Apple system palette (each swaps to its dark mode variant with the theme) or any CSS color.
badgeTextColordefault"#ffffff"stringAny CSS color for the digits in the badge.
surfaceColordefault""stringAny CSS color for the round button. Empty uses #F4F4F9 light, #262626 dark.
iconColordefault""stringAny CSS color for the bell glyph. Empty uses #868593 light, #9B9AA7 dark.
ringStrengthdefault1numberHow hard the bell swings when the count goes up: 0 keeps it still, 1 is the original swing, 2 twice the kick.
labeldefault"Notifications"stringWhat screen readers hear with no unread notifications; also the button's name.
unreadLabeldefault"Notifications, {count} unread"stringWhat screen readers hear with unread notifications; {count} fills in, e.g. "{count} unread notifications".
asChilddefaultfalsebooleanUses your own child as the trigger instead of the built-in button, so the badge can sit on an avatar or a nav item. Your element should be round for the badge to line up, and the bell swing only runs on the built-in button.
childrenReactNodeThe custom trigger when asChild is set. Ignored otherwise.
classNamestringExtra classes merged onto the root element; other button props are spread onto it too. Sizing is set inline from the size prop, so a width or height class here will not take effect.
Parts
NotificationBellColor
typeThe named badge colors: "red" | "orange" | "green" | "blue" | "violet". color also takes any CSS color.
Examples
App header
Between search and the avatar at 40px; opening it marks everything read and the badge shrinks away.
Messages arriving
Each new message swings the bell and rolls the count; clearing them hides the badge.
Dot, colors and overflow
variant dot hides the number; color takes a system name or any CSS color; past max the badge reads 99+.
Dependencies
Files
- components/ui/notification-bell.tsx
FAQ
Is the React Notification Bell component free?
Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.
How do I install Notification Bell?
Run npx wingo-ui@latest add notification-bell. It also adds the Wingo UI items it builds on (Motion presets and UIProvider) and the npm packages motion and @radix-ui/react-slot. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/notification-bell.json.
See also
More React feedback components
Articles using this component
- React Notification Center: Inbox, Bell and Toasts
Component guides8 min read