NotificationCenter
onViewAll (or viewAllHref, a link) adds a "View all" action at the bottom of the dropdown; it closes the dropdown first, then calls your handler. maxItems shows only the newest few and the action then reads "View all (12)", with the total. Customize the text with viewAllLabel; linkComponent / linkProp make viewAllHref a router link.
Props
NotificationCenter
notificationsNotification[]Notifications, newest first. See the Notification table below.
onSelect(notification) => voidCalled when one is clicked.
onMarkRead(id) => voidCalled when an unread one is clicked.
onMarkAllRead() => voidAdds a "Mark all read" action.
onClear() => voidAdds a "Clear" action.
onViewAll() => voidAdds a "View all" footer action; it closes the dropdown, then calls this.
viewAllHrefstringSame, as a link.
viewAllLabelstringDefault:'View all'Text for the "View all" action.
linkComponentElementTypeDefault:'a'Router link used for
viewAllHref.linkPropstringDefault:'href'Name of its destination prop.
maxItemsnumberShow only the newest this many; "View all" then shows the total.
emptystringDefault:'You are all caught up'Shown when there are none.
align'end' | 'start'Default:'end'Which edge of the bell the panel aligns to.
| Prop | Type | Default | Description |
|---|---|---|---|
notifications | Notification[] | – | Notifications, newest first. See the Notification table below. |
onSelect | (notification) => void | – | Called when one is clicked. |
onMarkRead | (id) => void | – | Called when an unread one is clicked. |
onMarkAllRead | () => void | – | Adds a "Mark all read" action. |
onClear | () => void | – | Adds a "Clear" action. |
onViewAll | () => void | – | Adds a "View all" footer action; it closes the dropdown, then calls this. |
viewAllHref | string | – | Same, as a link. |
viewAllLabel | string | 'View all' | Text for the "View all" action. |
linkComponent | ElementType | 'a' | Router link used for viewAllHref. |
linkProp | string | 'href' | Name of its destination prop. |
maxItems | number | – | Show only the newest this many; "View all" then shows the total. |
empty | string | 'You are all caught up' | Shown when there are none. |
align | 'end' | 'start' | 'end' | Which edge of the bell the panel aligns to. |
Notification
idstring | numberUnique id of the notification.
titleReactNodeHeadline of the notification.
bodyReactNodeText under the title.
timeReactNodeWhen it arrived.
readbooleanDefault:falseWhether it has been read; unread ones are counted and marked.
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | number | – | Unique id of the notification. |
title | ReactNode | – | Headline of the notification. |
body | ReactNode | – | Text under the title. |
time | ReactNode | – | When it arrived. |
read | boolean | false | Whether it has been read; unread ones are counted and marked. |
Related hooks and theme:useDismissable