Installation
$ pnpm dlx shadcn@latest add @synccn/notification-centerFirst time in this project? Connect synccn with one command.
Usage
import { NotificationCenter } from "@/components/ui/notification-center";<NotificationCenter items={notifications} />API reference
Generated from the component's TypeScript types, so it always matches the code.
NotificationCenter
Bell button with an unread badge that opens a panel of notifications, with All/Unread tabs, mark-as-read on click and "Mark all as read". items: [{ id, title, body?, time, read?, icon?, avatar? }]
PropTypeDescription
- itemsrequired
NotificationItem[]Initial notifications.
- align
"start" | "end"Default
"end"Which edge of the bell the panel lines up with.
- onOpenSettings
() => voidShows a settings button that calls this.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Bell, CheckCheck, Settings
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: tab, tablist
- ARIA attributes: aria-expanded, aria-label, aria-selected
- Closes with Escape
- Closes when you click or tap outside
- Flips to whichever side has room, so it stays on screen
More overlays
DialogModal with focus trap, scroll lock and Escape to close.SheetPanel that slides in from the left, right or bottom.Dropdown MenuActions, checkboxes, labels and shortcuts with arrow-key navigation.Context MenuRight-click menu that also opens on long-press.PopoverFloating panel anchored to a trigger.TooltipLabel on hover and focus, on any side.