Updated
Notification Bell
NewCustomize
Count3
Max99
Color
Soft
Medium
Installation
npx shadcn@latest add https://uibrik.com/r/notification-bell.jsonInstall the packages
npm install @number-flow/react motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/notification-bell/notification-bell.tsx"use client"; import NumberFlow from "@number-flow/react"; import { AnimatePresence, motion, useAnimationControls, useReducedMotion } from "motion/react"; import { useEffect, useRef, useState } from "react"; import { cn } from "@/lib/utils"; const EASE_OUT: [number, number, number, number] = [0.23, 1, 0.32, 1]; const SIZES = { sm: { box: 32, icon: 18 }, md: { box: 40, icon: 20 }, lg: { box: 48, icon: 22 }, } as const; const VARIANTS = { soft: "bg-neutral-100 hover:bg-neutral-200/70 dark:bg-neutral-900 dark:hover:bg-neutral-800", ghost: "bg-transparent hover:bg-neutral-100 dark:hover:bg-neutral-900", } as const; const RING = { rest: { pathLength: 0, opacity: 0, x: 0 }, ring: (side: number) => ({ pathLength: [0, 1, 1],
Adds the files to
components/uibrik/notification-bell and installs @number-flow/react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/notification-bell.Usage
import { NotificationBell } from "@/components/uibrik/notification-bell/notification-bell";<NotificationBell defaultCount={3} clearOnClick max={99} dot={false} color="#dc2626" variant="soft" size="md" onClick={() => {}} // count={0} // onCountChange={(count) => {}}/>Where to use Notification Bell
App navbars
The swing catches the eye only when something new arrives, so the bell can sit quietly the rest of the time.
Pairs with Notification Center and Classic Navbar
Dashboards
Counts roll up digit by digit, so a jump from 9 to 10 reads as more, not as a different number.
Pairs with Project Dashboard
Inbox and mentions
A dot mode suits places where the exact number matters less than knowing there is something.
Pairs with Event Feed
Props
NotificationBell- defaultCount
- Type number
- 3
- Unread count on mount when uncontrolled.
- clearOnClick
- Type boolean
- true
- Mark everything read when pressed.
- max
- Type number
- 99
- Counts above this show as "max+".
- dot
- Type boolean
- false
- A dot instead of a number.
- color
- Type string
- "#dc2626"
- Badge colour.
- variant
- Type "soft" | "ghost"
- "soft"
- Filled, or transparent until hovered.
- size
- Type "sm" | "md" | "lg"
- "md"
- Button and icon size.
- count / onCountChange
- Type number / (count) => void
- –
- Controlled unread count. Raising it swings the bell.
- onClick
- Type () => void
- –
- Called on press, e.g. to open a panel.
- className
- Type string
- –
- Classes for the button.