# Notifications

Source: https://ecosphere.dev/docs/feedback/notifications (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

The popover under the bell, with a tab per category and a row per notification.

`import { EcoNotifications } from "vue-ecosphere"`

## Notifications

Open the bell. Switch categories, click a row to mark it read, or mark them all.

Vue (vue-ecosphere):

```vue
<EcoNotifications v-model:open="open" v-model:tab="tab" :items="items" :tabs="[
  { key: 'all', label: 'All' },
  { key: 'rep', label: 'Replies', count: 2 },
  { key: 'alr', label: 'Alerts', count: 3 },
  { key: 'sys', label: 'System', count: 2 },
]" @mark-all="markAll" @select="openRow" />

// items
{ id: 1, kind: "reply", category: "rep", title: "Grace Kim", text: "Replied to your request", date: "Aug 8", unread: true }
{ id: 3, kind: "fup", category: "alr", section: "Needs a follow-up", title: "Adam Woods", text: "Idle for 8 days — needs an owner", date: "Aug 8", unread: true }
{ id: 5, kind: "err", category: "alr", section: "Errors", title: "Message could not be delivered", … }
{ id: 6, kind: "sys", category: "sys", title: "Sync complete", … }
```

React (react-ecosphere):

```tsx
const [open, setOpen] = useState(false);
const [tab, setTab] = useState("all");

<EcoNotifications open={open} onOpenChange={setOpen} tab={tab} onTabChange={setTab} items={items} tabs={[
  { key: "all", label: "All" },
  { key: "rep", label: "Replies", count: 2 },
  { key: "alr", label: "Alerts", count: 3 },
  { key: "sys", label: "System", count: 2 },
]} onMarkAll={markAll} onSelect={openRow} />

// items
{ id: 1, kind: "reply", category: "rep", title: "Grace Kim", text: "Replied to your request", date: "Aug 8", unread: true }
{ id: 3, kind: "fup", category: "alr", section: "Needs a follow-up", title: "Adam Woods", text: "Idle for 8 days — needs an owner", date: "Aug 8", unread: true }
{ id: 5, kind: "err", category: "alr", section: "Errors", title: "Message could not be delivered", … }
{ id: 6, kind: "sys", category: "sys", title: "Sync complete", … }
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `EcoNotification[]` | — | { id, title, text?, date?, unread?, kind?: 'reply' \| 'fup' \| 'err' \| 'sys', icon?, category?, section? }. |
| `tabs` | `EcoNotificationTab[]` | [] | { key, label, count? }. key 'all' groups every row under its category's label; other tabs group by section. |
| `v-model:open` | `boolean` | false | notif.is-open. The bell toggles it; Escape and an outside click close it. |
| `v-model:tab` | `string` | "all" | The selected category tab (arrow keys move between tabs). |
| `title / markAllLabel / viewAllLabel / bellLabel` | `string` | — | Header, “Mark all as read”, the footer link (empty hides it) and the bell's accessible name. |
| `#trigger` | `slot { attrs, open, toggle }` | — | Replace the bell icon button. |
| `@select / @mark-all / @view-all` | `events` | — | A row was clicked; the header link; the footer link. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `EcoNotification[]` | — | { id, title, text?, date?, unread?, kind?: 'reply' \| 'fup' \| 'err' \| 'sys', icon?, category?, section? }. |
| `tabs` | `EcoNotificationTab[]` | [] | { key, label, count? }. key 'all' groups every row under its category's label; other tabs group by section. |
| `open / onOpenChange` | `boolean` | false | notif.is-open. The bell toggles it; Escape and an outside click close it. |
| `tab / onTabChange` | `string` | "all" | The selected category tab (arrow keys move between tabs). |
| `title / markAllLabel / viewAllLabel / bellLabel` | `string` | — | Header, “Mark all as read”, the footer link (empty hides it; calls onViewAll) and the bell's accessible name. |
| `renderTrigger` | `(scope: { attrs, open, toggle }) => ReactNode` | — | Replace the bell icon button: spread attrs on yours. |
| `onSelect / onMarkAll / onViewAll` | `events` | — | A row was clicked; the header link; the footer link. |
