Notification center

Notification center is a compact, grouped inbox card that shows the two most recent notices with an unread count. Clicking an item marks it read, and a toggle expands the list to show all items with motion-animated layout changes.

uioverlays-surfacesregistry-item.json
Notification center
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @motion-lexicon/notification-center

Requires @motion-lexicon in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { NotificationCenter } from "@/components/motion-lexicon/notification-center";export default function Example() {  return (    <NotificationCenter      items={[        { id: "1", title: "Deploy finished", detail: "production — v2.4.1", time: "2m", unread: true },        { id: "2", title: "New comment", detail: "Mina left a note on the spec", time: "12m", unread: true },        { id: "3", title: "Invoice paid", detail: "Order #1042 settled", time: "1h" },      ]}    />  );}
  • Showing a recent, readable history of transient notices such as alerts, mentions, or system messages inside a product UI.
  • Surfaces where users need to mark notifications as read and act on them, with an unread count at a glance.
  • Dashboards or sidebars that should preview the two latest items and expand on demand.
  • Product-style interfaces that want a monochrome, minimal inbox aesthetic with subtle motion.

Examples

Basic inbox with unread items

Renders a notification center with mixed read and unread items. Only the first two items show until the user expands the list.

basic-inbox-with-unread-items.tsx
import { NotificationCenter, type NotificationCenterItem } from "@/components/motion-lexicon/notification-center";const items: readonly NotificationCenterItem[] = [  { id: "a", title: "Build succeeded", detail: "main @ 3f9c2e", time: "just now", unread: true },  { id: "b", title: "Review requested", detail: "Kenji asked you to review PR #218", time: "5m", unread: true },  { id: "c", title: "Weekly digest", detail: "Your summary is ready", time: "1d" },];export function BasicInbox() {  return <NotificationCenter items={items} />;}

Custom label and read tracking

Overrides the heading label and reports each item that the user marks as read through onRead.

custom-label-and-read-tracking.tsx
import { NotificationCenter } from "@/components/motion-lexicon/notification-center";export function TrackedInbox() {  return (    <NotificationCenter      label="Activity"      items={[        { id: "1", title: "Payment received", detail: "$120.00 from Acme", time: "3m", unread: true },        { id: "2", title: "Export ready", detail: "CSV with 4,210 rows", time: "20m", unread: true },        { id: "3", title: "Password changed", detail: "Security notice", time: "2h" },      ]}      onRead={(id) => console.log("read", id)}    />  );}

Positioned in a layout with a custom class

Adds layout classes through className to place the card in a sidebar with a fixed width.

positioned-in-a-layout-with-a-custom-class.tsx
import { NotificationCenter } from "@/components/motion-lexicon/notification-center";export function SidebarInbox() {  return (    <aside className="w-72">      <NotificationCenter        className="sticky top-4"        items={[          { id: "x1", title: "Trial ends soon", detail: "5 days remaining", time: "9m", unread: true },          { id: "x2", title: "Team joined", detail: "Sora joined Design", time: "1h" },        ]}      />    </aside>  );}

API reference

PropTypeDefaultDescription
itemsreadonly NotificationCenterItem[]—Notices to display. Each item has id (string), title (string), detail (string), time (string), and optional unread (boolean). Only the first two items are shown until the list is expanded. Unread state is initialized from unread flags on mount.
labelstring"Notifications"Heading text shown next to the eyebrow and linked to the section through aria-labelledby.
classNamestring""Extra class names appended to the root section element.
onRead(id: string) => void—Called with the item id when the user clicks an item and it is marked as read.

Accessibility

  • The root is a section labelled by its heading via aria-labelledby, so it is announced as a named region.
  • Each notification is a native button with type="button" and a minimum height of 44px, so it is keyboard focusable and activates with Enter or Space.
  • Focus is shown with a 2px #4568FF focus-visible ring on items and the toggle button.
  • Unread status is conveyed only by the color tint and the aria-hidden dot, so screen reader users do not hear it; consider adding visually hidden text such as 'unread' in your item title or detail if status matters.
  • The unread count badge is plain text and is not a live region; wrap it in aria-live="polite" if new notices should be announced.
  • The expand toggle does not expose aria-expanded or aria-controls; add them via a wrapper if assistive tech must know the expanded state.
  • Reduced motion: the toggle's fade-in is disabled when the user prefers reduced motion, but row layout animations still run.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Notification center" component (motion-lexicon/notification-center) from its shadcn registry.1. Install it with: npx shadcn@latest add @motion-lexicon/notification-center2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: items, label, className, onRead.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { NotificationCenter } from "@/components/motion-lexicon/notification-center";export default function Example() {  return (    <NotificationCenter      items={[        { id: "1", title: "Deploy finished", detail: "production — v2.4.1", time: "2m", unread: true },        { id: "2", title: "New comment", detail: "Mina left a note on the spec", time: "12m", unread: true },        { id: "3", title: "Invoice paid", detail: "Order #1042 settled", time: "1h" },      ]}    />  );}```

Files & dependencies

  • src/registry/components/notification-center.tsx→ components/motion-lexicon/notification-center.tsx
dependenciesmotion

Looks similar, elsewhere