# Notification Center (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-notification-center` · version 1.0.0 · block · pro (Pro)
- category: App screens
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add @beautiful-ui-pro/lumen-notification-center`
- npm dependencies: none
- registry dependencies: utils, @beautiful-ui/lumen-avatar, @beautiful-ui/lumen-button, @beautiful-ui-pro/lumen-popover, @beautiful-ui/lumen-tabs, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-notification-center
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A bell with a live unread count that opens your updates, grouped by when they happened and filtered to All, Unread or Mentions. Opening one marks it read; Mark all read clears the lot. The list also works on its own, for a notifications page or a sidebar.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: none beyond React.
- Files: `components/ui/lumen/blocks/notification-center.tsx`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-avatar`, `lumen-button`, `lumen-popover`, `lumen-tabs`, `lumen-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `NotificationCenter`, `NotificationPanel`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-foreground`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-chart-accent`, `--lumen-chart-accent-foreground`, `--lumen-chart-accent-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`); this item's CSS also reads `--lumen-font-mono`, `--lumen-font-sans`, `--lumen-radius-k`. Never add Tailwind colour classes inside the component.

```tsx
import { NotificationCenter, type Notification } from "@/components/ui/lumen/blocks/notification-center";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `NotificationCenter` | `notification-bell` | The bell with its count, and the popover holding the panel. |
| `NotificationPanel` | `notification-panel` | Header, filters and the grouped list, usable on its own. |

Style a part with `[data-slot="<slot>"]` selectors or its `className`; keep the attributes when editing.

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/blocks/notification-center.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- notification center, notifications bell, inbox of updates, activity notifications, unread count, mentions, mark all as read
- An app header's bell: updates, comments and mentions with an unread count
- A notifications page or side panel (NotificationPanel on its own)

### Not when
- A one-off confirmation or error: use Toast
- A history of changes to one record: use Activity Timeline

## Mistakes
- Persist read state from onNotificationsChange; the component only changes what it shows
- Pass `time` already worded ("4m", "Yesterday"); the component doesn't format dates
- Keep ids stable so read state survives a refetch

## Usage

```tsx
"use client";
import * as React from "react";
import { useRouter } from "next/navigation";
import { NotificationCenter, type Notification } from "@/components/ui/lumen/blocks/notification-center";

export function HeaderBell({ initial }: { initial: Notification[] }) {
  const router = useRouter();
  const [items, setItems] = React.useState(initial);
  return (
    <NotificationCenter
      notifications={items}
      onNotificationsChange={(next) => {
        setItems(next);
        const read = next.filter((n) => n.read).map((n) => n.id);
        void fetch("/api/notifications/read", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ids: read }) });
      }}
      onItemClick={(n) => n.href && router.push(n.href)}
    />
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `notifications / defaultNotifications / onNotificationsChange` | `Notification[] / Notification[] / (next) => void` |  | Notification = { id, actor, message, time, group?, read?, mention?, preview?, avatarUrl?, href? }. Controlled or not; read state changes come back through onNotificationsChange. |
| `onItemClick` | `(item) => void` |  | A row was opened (it's marked read first). Route with item.href. |
| `filter / defaultFilter / onFilterChange` | `"all" \| "unread" \| "mentions"` | `"all"` | The tab. |
| `open / defaultOpen / onOpenChange` | `boolean / boolean / (open) => void` |  | NotificationCenter: the panel, controlled or not. |
| `align` | `"start" \| "center" \| "end"` | `"end"` | NotificationCenter: where the panel opens from the bell. |
| `maxListHeight` | `number` | `380` | The list's largest height before it scrolls. |
| `labels` | `Partial<NotificationLabels>` |  | Every word, for i18n: title, filters, empty lines, the bell's name bell(unread). |

Full docs: https://beautiful-ui.dev/components/lumen-notification-center

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| Enter / Space (bell) | Open or close the panel |
| Tab | Mark all read, the filters, then the list |
| ↑ / ↓ | Previous or next notification |
| Home / End | First or last notification |
| Enter | Open the notification (marks it read) |
| Escape | Close the panel and return to the bell |

## Performance

- Plain lists; every notification renders. For hundreds, page them (load more at the end) rather than passing everything

## Responsive

- The panel is 380px wide at most and never wider than the screen less 24px; the per-row mark button is always visible on touch screens

## Motion inventory

| Interaction | What moves |
|---|---|
| Count | The bell's count pops in when it changes |
| Read | The unread dot dims and shrinks away |
| Open | The panel rises from the bell (the popover's own motion) |

## Accessibility contract (preserve when editing)
- The bell is a button named with the unread count ("Notifications, 3 unread"); the count badge itself is hidden from screen readers
- The filters are tabs; groups are labelled sections and rows are buttons, with "unread" read out after the time
- Up and Down move between rows (one tab stop for the list); Mark all read is announced through a polite live region
- Unread is shown by a dot and by stronger text, so colour is never the only cue

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/lumen-notification-center
```

Pro item: needs the `@beautiful-ui-pro` registry in `components.json` and `BEAUTIFUL_UI_TOKEN` in `.env.local` (https://beautiful-ui.dev/account). Setup: https://beautiful-ui.dev/docs/pro. Your components.json `style` picks the build: radix-*, new-york and default get Radix, base-* gets Base UI.

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
