How it works
A swipe only starts after 8px of mostly horizontal travel, so vertical scrolling stays native; release past 35% of the width or faster than 0.6px/ms dismisses, and a red layer with a cross fades in under the row as it travels. Dismissed rows collapse with grid-template-rows before onDismiss is called. The tab ink measures its tab and slides between tabs.
Use it for
- Apps with activity from other people or systems: mentions, approvals, build results.
- A persistent place to catch up on what changed.
Look elsewhere when
- Immediate feedback for the user's own action: use a toast or snackbar.
- Critical alerts that must be read: show them in the page.
Usage
import { NotificationCenter } from './NotificationCenter.jsx'
export function HeaderBell({ items, markRead, markAllRead, remove }) {
return (
<NotificationCenter
items={items} // { id, title, body?, time, group?, unread?, avatar?, kind? }[]
tabs={[
{ id: 'all', label: 'All' },
{ id: 'mentions', label: 'Mentions', filter: (i) => i.kind === 'mention' },
{ id: 'unread', label: 'Unread', filter: (i) => i.unread },
]}
onRead={markRead}
onReadAll={markAllRead}
onDismiss={remove}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
items | { id, title, body?, time, group?, unread?, avatar? }[] | — | Notifications, newest first; consecutive items with the same group share a heading. |
tabs | { id, label, filter?: (item) => boolean }[] | — | Optional tabs; each shows its unread count. |
onRead | (id) => void | — | Mark one as read (check button or Enter). |
onReadAll | () => void | — | Mark all as read. |
onDismiss | (id) => void | — | Remove one; called after its row has collapsed. |
labels | object | — | Replaces title, bell ({n}), bellNone, markAll, markRead, dismiss, unread, empty and emptyHint. |
defaultOpen | boolean | false | Open the panel on first render. |
defaultTab | string | first tab | Initially selected tab. |
emptyIcon | ReactNode | — | Replaces the all-caught-up icon. |
Accessibility
- The bell's accessible name includes the unread count; it has aria-expanded and aria-controls, and the panel is a role dialog labelled by its title.
- Tabs follow the tablist pattern with Left and Right; each item is focusable, Enter marks it read and Delete dismisses it.
- Row actions appear on hover and on keyboard focus, with accessible names and 32px targets; on touch screens swiping replaces them.
- Unread is shown by a dot, a tint and a spoken label, not colour alone; the empty state is a role status message.
- Escape closes the panel and returns focus to the bell; a click outside closes it.
- With reduced motion the bell does not swing, rows disappear at once and the panel only fades.
Motion
Panel 240ms cubic-bezier(0.32, 1.2, 0.5, 1) from 0.96 scale at the bell; bell swing 700ms; badge pop 420ms spring; tab ink 280ms; row collapse 280ms; swipe snap-back 320ms ease-out.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
NotificationCenter.jsxnotification-center.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.



