Installation
Usage
"use client"
import { NotificationInbox } from "@/components/notification-inbox"
export function Bell() {
return (
<NotificationInbox
defaultItems={[
{ id: "1", actor: "Emily Carter", action: "mentioned you in", target: "Q3 launch plan", at: "2026-11-05T09:30:00Z", mention: true },
{ id: "2", actor: "James Walker", action: "approved", target: "Pull request #482", at: "2026-11-04T16:00:00Z", read: true },
]}
onRead={(ids) => console.log("read", ids)}
onArchive={(id) => console.log("archived", id)}
/>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items / defaultItems | InboxItem[] | [] | The notifications, kept by you or by the component. Each has id, actor, action, at, and optionally target, preview, avatar, read, mention, href. |
| onItemsChange | (items) => void | — | Called with the new list after anything is read or archived. |
| onRead | (ids: string[]) => void | — | Called with the ids just marked as read: save it on your server. |
| onArchive | (id: string) => void | — | Called with the id just archived. |
| onSelect | (item) => void | — | Called when a notification is chosen. It is marked read first. |
| defaultOpen | boolean | false | Start with the panel open. Focus stays where it is until someone uses it. |
| label | string | "Notifications" | Accessible name of the bell and the panel. |
| tabs | boolean | true | Show the All, Mentions and Unread tabs. |
| align | "start" | "end" | "end" | Which side of the bell the panel lines up with. |
| emptyMessage | ReactNode | — | Shown when a tab has nothing. |
| footer | ReactNode | — | Shown at the foot of the panel. |
Accessibility
- The bell says how many are unread; the panel is a dialog, and Escape closes it and gives focus back to the bell.
- Up and Down move between notifications, Enter opens one, Delete archives it.
- New arrivals, marking as read and archiving are announced to screen readers.
- On touch, swipe a notification left to archive it; the Archive button does the same.
- Motion stops under prefers-reduced-motion.
Changelog
- v1.0.0Latest
First release.