---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Notification center

The bell at the end of the top bar, and its panel of notifications, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `NotificationCenter`.

## Try it

Open the bell: point at a row (or Tab to it) to mark it read or unread, archive or dismiss it, or use its options; accept or decline the invitation; Mark all as read clears the count; switch to Unread. The line under it says the view shown and a row whose options are open. Pick a look: four bells and their counts, a long row, a list that scrolls, the bell in a top bar.

The people and notifications are our own sample: nothing is sent or stored.

## When to use

- The bell at the end of the top bar, and its panel of notifications.
- Also called: notifications panel or inbox.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Notification center on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-notification-center.json --yes
```

```text
Add the Goop Notification center to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import {
  NotificationCenter, NotificationCenterTrigger, NotificationCenterContent, NotificationCenterHeader, NotificationCenterList, NotificationCenterGroup, NotificationCenterItem, NotificationCenterEmpty,
  NotificationCenterFooter,
} from '@/components/ui/goop/notification-center';
import { useState } from 'react';
import { TopBar, TopBarRow, TopBarGroup } from '@/components/ui/goop/top-bar';

function Inbox() {
  const [notes, setNotes] = useState([{ id: 'n1', who: 'Bilal Rashed', did: 'commented on Transcript search', unread: true }]);
  const mark = (id: string, unread: boolean) =>
    setNotes((all) => all.map((note) => (note.id === id ? { ...note, unread } : note)));
  return (
    <TopBar>
      <TopBarRow>
        <TopBarGroup align="end">
          <NotificationCenter unread={notes.filter((note) => note.unread).length}>
            <NotificationCenterTrigger />
            <NotificationCenterContent>
              <NotificationCenterHeader onMarkAllRead={() => setNotes((all) => all.map((n) => ({ ...n, unread: false })))} />
              <NotificationCenterList>
                {notes.map((note) => (
                  <NotificationCenterItem
                    key={note.id}
                    unread={note.unread}
                    time="2h"
                    href={`/notifications/${note.id}`}
                    onSelect={() => mark(note.id, false)}
                    onUnreadChange={(unread) => mark(note.id, unread)}
                    onArchive={() => setNotes((all) => all.filter((n) => n.id !== note.id))}
                  >
                    <strong>{note.who}</strong> {note.did}
                  </NotificationCenterItem>
                ))}
              </NotificationCenterList>
              <NotificationCenterFooter href="/notifications" />
            </NotificationCenterContent>
          </NotificationCenter>
        </TopBarGroup>
      </TopBarRow>
    </TopBar>
  );
}
```

- Fits: frame: top-bar.
- Also known as: NotificationBell, InboxPopover, NotificationsPanel, NotificationDropdown.
- Put a NotificationCenter at the end of the top bar with the unread count from your data; fill it with NotificationCenterItems, mark rows read in your own state, and link the footer to the full notifications page.
- height, width, padding, gap, corner, border, background, text, motion: add no class for these.

## API reference

### Parts

- `NotificationCenterTrigger` — The bell; its props: notification-center--trigger.md
- `NotificationCenterContent` — The panel; its props: notification-center--content.md
- `NotificationCenterHeader` — The header; its props: notification-center--header.md
- `NotificationCenterList` — The rows; its props: notification-center--list.md
- `NotificationCenterGroup` — Rows under a day's heading (`label`: "Today", "Earlier") in a `NotificationCenterList`; hidden with no row shown; its props: notification-center--group.md
- `NotificationCenterItem` — A row; its props: notification-center--item.md
- `NotificationCenterEmpty` — The empty state; its props: notification-center--empty.md
- `NotificationCenterFooter` — The footer; its props: notification-center--footer.md

### NotificationCenterContent

The panel.

```tsx
import { NotificationCenterContent } from '@/components/ui/goop/notification-center';
```

### Options

- Also takes: container?: HTMLElement | null; frameClassName?: string

### NotificationCenterEmpty

The empty state.

```tsx
import { NotificationCenterEmpty } from '@/components/ui/goop/notification-center';
```

### Options

- title?: ReactNode = 'You’re all caught up' — The title.
- description?: ReactNode = 'New notifications will show here.' — The line under it; `null` shows none.

### NotificationCenterFooter

The footer.

```tsx
import { NotificationCenterFooter } from '@/components/ui/goop/notification-center';
```

### Options

- href: string — The full notifications page.

### NotificationCenterGroup

Rows under a day's heading (`label`: "Today", "Earlier") in a `NotificationCenterList`; hidden with no row shown.

```tsx
import { NotificationCenterGroup } from '@/components/ui/goop/notification-center';
```

### Options

- label: ReactNode — The heading's words ("Today", "Earlier").
- children?: ReactNode — The group's `NotificationCenterItem`s.

### NotificationCenterHeader

The header.

```tsx
import { NotificationCenterHeader } from '@/components/ui/goop/notification-center';
```

### Options

- title?: ReactNode — The heading's words; left out, the center's label.
- onMarkAllRead?: () => void — Called when Mark all as read is pressed: mark every notification read in your own state.
- markAllLabel?: string = 'Mark all as read' — Mark all as read's words.
- markedMessage?: string = 'All marked as read' — What a screen reader hears after Mark all as read.
- action?: ReactNode — A control of your own at the title row's end, in place of Mark all as read.
- allLabel?: string = 'All' — The All view's words.
- unreadLabel?: string = 'Unread' — The Unread view's words.

### NotificationCenterItem

A row.

```tsx
import { NotificationCenterItem } from '@/components/ui/goop/notification-center';
```

### Options

- unread?: boolean = false — Unread: the accent dot, and "Unread" said first.
- onUnreadChange?: (unread: boolean) => void — Marked read (`false`) or unread (`true`) by its quick action.
- onArchive?: () => void — Archived by its quick action; the focus moves to the next row.
- onDismiss?: () => void — Dismissed by its quick action; the focus moves to the next row.
- inlineActions?: ReactNode — Your small Buttons under the sentence (Accept, Decline).
- media?: ReactNode — The picture at the row's start: a 24 px Avatar (`size="md"`), or a glyph.
- children: ReactNode — The notification, one sentence (the person's name in a `strong`); two lines at most.
- time: ReactNode — When it happened ("2h", "Yesterday"), at the row's end.
- href?: string — Where the row goes: the whole row is this link.
- onSelect?: () => void — Called when the row is pressed (before an `href` is followed): mark it read here.
- actions?: ReactNode — The row's options: `DropdownMenuItem`s behind a dots button at the row's end.
- actionsLabel?: string = 'Options' — The options button's name, read with the sentence.
- actionsOpen?: boolean — The options menu open, controlled.
- defaultActionsOpen?: boolean — The options menu open at first, uncontrolled (closed by default).
- onActionsOpenChange?: (open: boolean) => void — Called when the options menu opens or closes.
- unreadLabel?: string = 'Unread' — What the dot says to a screen reader.
- markReadLabel?: string = 'Mark as read' — Default "Mark as read".
- markUnreadLabel?: string = 'Mark as unread' — Default "Mark as unread".
- archiveLabel?: string = 'Archive' — Default "Archive".
- dismissLabel?: string = 'Dismiss' — Default "Dismiss".

### NotificationCenterList

The rows.

```tsx
import { NotificationCenterList } from '@/components/ui/goop/notification-center';
```

### Options

- empty?: ReactNode — What shows while no row is in the current view; default `<NotificationCenterEmpty />`.

### NotificationCenter: every option

```tsx
import { NotificationCenter } from '@/components/ui/goop/notification-center';
```

### Options

- unread: number — How many are unread: the count on the bell and in its name.
- label?: string = 'Notifications' — The panel's name and heading.
- view?: 'all' | 'unread' — Which rows show, controlled: `all` or `unread`.
- defaultView?: 'all' | 'unread' = 'all' — Which rows show at first, uncontrolled.
- onViewChange?: (view: 'all' | 'unread') => void — Called with the view a person picks.
- Also takes: open?: boolean; defaultOpen?: boolean = false; onOpenChange?: (open: boolean) => void; modal?: boolean
- Takes every prop of Popover (its page: popover.md)
- State: view (view / defaultView / onViewChange); open (open / defaultOpen / onOpenChange)

### NotificationCenterTrigger

The bell.

```tsx
import { NotificationCenterTrigger } from '@/components/ui/goop/notification-center';
```

### Options

- aria-label?: string — The button's name; left out, the panel's label and the unread count.
- Also takes: type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean

## Keyboard

- Enter / Space: on the bell: open the panel, the focus on its first control
- Tab: Mark all as read, the views, each row, its quick actions (read or unread, archive, dismiss) and its options button, then the footer link
- ArrowLeft / ArrowRight: on the views: move between All and Unread
- Escape: close the open options menu, else the panel, the focus back on what opened it

## Accessibility

- The part itself answers the keys above.
- hover, active, focus-visible, focus-within: the browser's own (:hover, :active, :focus-visible, :focus-within): write nothing

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

Shortened to fit: the data-slot values.

## Related

- [Top bar](/themes/trail/components/top-bar): The bar across the top of a page in the app frame, with its title, tabs and actions.
- [Account menu](/themes/trail/components/account-menu): The signed-in person's menu: who is signed in, the light and dark choice, and signing out.
- [Workspace switcher](/themes/trail/components/workspace-switcher): The sidebar's menu that shows the current workspace and switches to another or creates one.
- [Toast](/themes/trail/components/toast): A short notice at a corner of the app that confirms an action and goes by itself, with an optional action such as Undo.
