Notification Inbox
A bell with an unread count that opens a notification popover: All and Mentions tabs, unread dots, mark all read, type icons and an empty state. Built in React.
Click the bell
Installation
npx shadcn@latest add @minidev/notification-inbox
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/notification-inbox.json
Usage
import { NotificationInbox } from "@/components/ui/notification-inbox"
export function Example() {
return (
<NotificationInbox />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| notesInitial notifications, newest first. The inbox then tracks read state itself. | Note[] | SAMPLE |
| onOpenNoteCalled when a notification is opened (it is also marked read). | (note: Note) => void | - |
| onMarkAllReadCalled after "Mark all read". | () => void | - |
| viewAllHrefFooter link to the full activity page. Omit to hide the footer. | string | "#" |
| classNameClasses for the bell trigger. | string | - |
When to use
Built on Base UI Popover: focus moves in on open, Escape closes and returns focus to the bell, whose accessible name includes the unread count. Opening a row marks it read. Use it in app headers; for a single row use NotificationItem, for settings use NotificationPreferences.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | On the bell, opens the inbox and moves focus inside. |
| TaborShiftTab | Moves through All, Mentions, Mark all read, each notification and the footer link. |
| EnterorSpace | On a notification, opens it and marks it read. |
| Escape | Closes the inbox and returns focus to the bell. |
Accessibility
- The bell's accessible name includes the count, such as "Notifications, 3 unread". The visual count badge is
aria-hiddenand caps at "99+". - All and Mentions are buttons with
aria-pressed, not a tablist, so the arrow keys do not move between them. - Each unread row ends with screen-reader text "Unread"; avatars and kind icons are
aria-hidden. - The popup is labelled "Notifications". Its fade and scale are CSS transitions, cut to 0.01ms under
prefers-reduced-motion: reduce.
Frequently asked questions
Why don't new notifications appear when I update `notes`?
notes is only the starting list: it seeds internal state on mount, and the inbox tracks read state itself from then on. To show new items, remount it with a changing key, such as key={latestId}, or copy the file and make notes controlled.
How do I sync read state with my server?
Use onOpenNote(note), called when a row is opened and marked read, and onMarkAllRead(). Send the change to your API from there. Opening a row does not close the popover, so navigate or show the item from onOpenNote.
How do I hide the View all activity link?
Pass viewAllHref="". The default is "#", which shows the footer.
Dependencies
npm
Built from
Examples
Your notifications
notes seeds the list once; onOpenNote fires when a row is opened, which also marks it read.
Empty inbox, no footer
With no notes the bell has no count and the list shows its caught-up message; viewAllHref="" removes the footer link.