# Notification Panel

The content of a notifications dropdown: Mark all as read, fit-content All and Unread tabs, rows with avatar, message, time and unread dot, and a footer link.

- Category: Navigation & Layout
- Page: https://wunderui.com/components/notification-panel
- Tier: Core and Pro

## Install

Notification Panel ships with WunderUI Core and Pro in the @wunderui/react package.

## Import

```tsx
import { NotificationPanel, NotificationPanelItem, NotificationPanelProps } from "@wunderui/react"
```

## Minimal usage

Then use it:

```tsx
import { NotificationPanel } from "@wunderui/react"

export function Notifications() {
  return (
    <NotificationPanel
      items={[
        { id: "n1", avatar: { initials: "PR" }, title: "Priya Raman mentioned you", description: "Can you confirm the launch date?", time: "5m ago", unread: true },
      ]}
    />
  )
}
```

Expected result: You should see the title Notifications with Mark all as read, the All and Unread tabs, one row with an avatar, the message, 5m ago and an indigo dot, and the View all notifications link.

## When to use

### Use Notification Panel for

- The dropdown or sheet that a bell in the top bar opens
- A short, recent list with a read and unread state
- A list that ends in a link to the full notification page

### Use something else

- [List Panel](https://wunderui.com/components/list-panel) for a dashboard card that lists rows, with its own title, states and footer button
- [Toast](https://wunderui.com/components/toast) for a message that appears for a moment and leaves by itself
- [Popover](https://wunderui.com/components/popover) for any other content that opens from a button

## Behavior

What the panel does with its tabs, its rows and the read state.

- **Read state:** The panel does not store anything. Each item says whether it is unread, and onMarkAllRead and onItemSelect tell you to change your data.
- **Tabs:** All shows every item and Unread only the unread ones. The tab is its own state, or controlled with tab and onTabChange. The Unread counter is the number of unread items.
- **Rows:** A row is one button that runs the item onSelect and then onItemSelect. The unread dot keeps its space when the row is read, so marking it never shifts the text.
- **Empty:** With nothing to show the panel says You are all caught up on the Unread tab, or No notifications yet on All, and Mark all as read is disabled while nothing is unread.
- **Motion:** The tab pill slides and the dot fades, with the motion tokens. With reduced motion both switch at once.

## Anatomy

- `NotificationPanel`: The panel without a surface: put it in a PopoverContent with p-0, a Sheet or a card. It is a section named by its title.
- `Header`: The title, 16 px semibold, and Mark all as read as a link button on the right. The button is disabled while nothing is unread.
- `Tabs`: All and Unread as a small segmented control, as wide as its labels. Unread carries a counter. Hide it with hideTabs.
- `Rows`: One list row per notification: an avatar or an icon tile, the title, the message, the time and an unread dot that keeps its space. Long titles wrap, nothing is cut. The rows scroll after 24 rem.
- `Footer`: A link under a separator, View all notifications. Pass footer={false} to hide it.

## Best practices

### When to use

- Use it for the dropdown behind a bell: a short list of what happened, with a way to mark it read and a link to the full list. For a list card on a dashboard use List Panel, for a transient message use Toast.

### Do

- Put it in a PopoverContent with p-0 and a width of about 24 rem (w-96). On a phone put it in a bottom Sheet instead.
- Keep the unread state in your data and mark a row read when it is pressed, so the dot, the Unread tab and the bell count agree.
- Write the message so it reads without the avatar: who did what, then the detail in the description.

### Don't

- Do not put approvals or forms in the rows. A row opens the item; the decision belongs on its page.
- Do not make the tabs full width. They end with the last tab.

## API reference

### NotificationPanel

| Prop | Type | Default | Description |
|---|---|---|---|
| items* | NotificationPanelItem[] |  | The notifications: id, title, description, time, an avatar (initials, src, color) or an icon, unread and onSelect. |
| defaultTab | "all" \| "unread" | "all" | The tab shown first when the panel keeps its own state. Default all. |
| footer | { label?: React.ReactNode; href?: string; onClick?: React.MouseEventHandler<HTMLElement> } \| false | {} | The footer link as label, href and onClick. With an href it is a link, without one a plain button. Pass false to hide it. |
| hideTabs | boolean |  | Hides the All and Unread tabs. |
| maxRowsHeight | string | "24rem" | How tall the rows grow before they scroll. Default 24rem. |
| onItemSelect | (item: NotificationPanelItem) => void |  | Runs when a row is pressed, after the item onSelect. |
| onMarkAllRead | () => void |  | Runs from Mark all as read. The button is disabled while no item is unread. |
| onTabChange | (tab: "all" \| "unread") => void |  |  |
| tab | "all" \| "unread" |  | The tab shown, all or unread, when you control it. Use it with onTabChange. |
| title | React.ReactNode | "Notifications" | The heading. Default Notifications. |

Also accepts React.HTMLAttributes attributes.

## Examples

### Tabs: All and Unread, with the count

### Without tabs: a short list

### Empty: nothing unread

## In context

### Bell in a top bar: the panel in a popover

The bell shows the unread count. A press on a row marks it read, Mark all as read clears them, and the footer link opens the full list.

## For AI agents

`get_component("notification-panel")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
