Use Inbox with workflows from the current Dashboard or @novu/framework.
- React: @novu/react
- Angular, Vue, Vanilla JS, and headless clients: @novu/js
The legacy @novu/notification-center package, including its Angular, Vue, web component, iframe, and headless clients, is for legacy Dashboard workflows only.
Inbox replaces the legacy Notification Center. The notification object, action handlers, tabs, appearance, localization, and HMAC options are the same across hosts. The mount path differs by framework.
Review the breaking changes, then use the React, Angular, Vue, or Vanilla JS section that matches your application.
Why you should upgrade#
- Appearance and layout options that replace the legacy
stylesAPI - A notification object that includes archive, snooze, severity, and action methods
- A smaller client surface:
@novu/reactfor React,@novu/jsfor every other host - Compatibility with current Dashboard workflows and
@novu/framework
Breaking Changes#
These changes apply to every host. React uses component props. Angular, Vue, and Vanilla JS pass the same fields to NovuUI options and mountComponent props.
Components#
- The
PopoverNotificationCentercomponent has been replaced with theInboxcomponent. - The
NotificationCentercomponent has been replaced with theNotificationscomponent. - The
NotificationBellcomponent has been replaced with theBellcomponent.
Styling#
- The
stylesprop is replaced by an enhanced, easy to useappearanceprop to customize the notification components. For more information onappearancecustomization, visit here.
Notification#
- Removal of
seen,lastSeenDate,content,templateIdentifier,payload,ctaproperties from the Notification object. - Archive, snooze, and severity support were added to the Notification object.
The legacy _id is the notification identifier and is not the same value as transactionId, which identifies the workflow trigger.
Subscriber prop#
The subscriberId prop is deprecated. Pass subscriber with either a subscriber ID string or a subscriber object.
Choose the Inbox package#
| Host | Uninstall | Install | Mount Inbox | Setup |
|---|---|---|---|---|
| React | @novu/notification-center | @novu/react | <Inbox /> | React quickstart |
| Angular | Angular Notification Center wrapper | @novu/js | NovuUI from @novu/js/ui | Angular quickstart |
| Vue | Vue Notification Center wrapper | @novu/js | NovuUI from @novu/js/ui | Vue quickstart |
| Vanilla JS | Web component, iframe script, or @novu/headless | @novu/js | NovuUI from @novu/js/ui, or @novu/js for a custom headless client | Vanilla JS quickstart |
There is no native Angular or Vue Inbox package. Those applications mount the same UI through @novu/js. React Native uses @novu/react-native.
The breaking changes, tabs, appearance, actions, and notification methods on this page apply to every host. React uses component props. Angular, Vue, and Vanilla JS pass the same fields to NovuUI options and mountComponent props.
React#
Uninstall @novu/notification-center and install @novu/react. Replace NovuProvider, PopoverNotificationCenter, and NotificationBell with <Inbox />.
Use subscriber, not the deprecated subscriberId prop. The React examples below map the remaining components, fields, and handlers. For HMAC, localization, and layout, follow the React Inbox quickstart.
Angular#
Uninstall the Angular Notification Center wrapper and install @novu/js. There is no native Angular Inbox package.
Mount Inbox with NovuUI from @novu/js/ui on an existing header, navbar, or sidebar element. Use a template reference such as #novuInbox, mount in ngAfterViewInit, and unmount in ngOnDestroy. Pass appearance, tabs, localization, and click handlers in the constructor options or in mountComponent props.
Follow the Angular Inbox quickstart for the install.
Vue#
Uninstall the Vue Notification Center wrapper and install @novu/js. There is no native Vue Inbox package.
Mount Inbox with NovuUI from @novu/js/ui from onMounted against a template ref, and unmount in onUnmounted. Inbox does not support server-side rendering. For Nuxt, wrap the component in <ClientOnly> and follow the Nuxt Inbox quickstart.
Follow the Vue Inbox quickstart for the install.
Vanilla JS#
Uninstall the web component, iframe embed, or @novu/headless client and install @novu/js.
Mount Inbox with NovuUI from @novu/js/ui after DOMContentLoaded on an existing element. A bundler is required for the @novu/js/ui import. For a plain HTML page, follow the Vanilla JS Inbox quickstart, which loads the UI bundle and stylesheet.
For a custom feed without the prebuilt UI, replace @novu/headless with @novu/js and rebuild queries, counts, and mutation methods against the current notification object. See the JavaScript SDK.
Basic usage#
The examples below use @novu/react. For Angular, Vue, and Vanilla JS, pass the same options to NovuUI and the same handlers in mountComponent props.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
Notification center without bell icon#
The @novu/react package introduces a flexible way to display notifications as a list without the default bell icon. Use the Inbox and Notifications components to achieve this functionality.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
Custom bell icon#
Customize the bell icon that triggers the notifications popover using the renderBell prop.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
Notification actions#
Handle user interactions with notifications effectively using the action handlers provided by @novu/react.
onNotificationClick#
Trigger a callback function when a user clicks on a notification item.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
onPrimaryActionClick and onSecondaryActionClick#
Handle primary and secondary actions within a notification explicitly.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
Avatar icons#
In the legacy implementation, you could set a notification’s avatar icon by enabling the Add an avatar option in the workflow UI. Novu would then use the avatar field of the actor subscriber as the icon.
In the new implementation, you can set the avatar icon for a notification by adding the avatar icon in the workflow UI. There are three options to choose from:
- Use a default avatar icon.
- Use a hard-coded avatar icon URL.
- Use a payload variable to dynamically set the avatar icon.
For more information, refer to Icons.
Popover positioning#
For advanced positioning and styling of the notifications popover, integrate third-party popover libraries such as Radix UI.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react and Radix UI as an example#
Custom notification item#
Customize the appearance and structure of individual notification items using the renderNotification prop.
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
Styling with appearance prop#
Customize the overall look and feel of the notification components using the appearance prop, which supports both CSS objects and class names (including Tailwind CSS classes).
Legacy implementation with @novu/notification-center#
Current implementation with @novu/react#
For more information on appearance customization visit here.
Multiple tabs support#
Organize notifications into different categories using tabs by leveraging the tags property in workflow definitions and the tabs prop in the Inbox component.
Create multiple tabs#
Legacy implementation with @novu/notification-center#
After defining the feeds on the workflow UI, you were able to filter notifications based on the feedIdentifier.
Current implementation with @novu/react#
- Define multiple workflows with relevant tags.
Add tags on the workflow Tags field. One tag can be used for multiple workflows.
- Use those tags in the
tabsprop of theInboxcomponent.
Each tab takes a filter object that supports tags, data, and severity. The older value array is deprecated, so replace value: ['security'] with filter: { tags: ['security'] }.
Localization#
Customize the language and text content of the notification components using the localization prop. Refer to the localization documentation.
HMAC encryption#
The process remains the same as before. For more information, refer to Secure your inbox with HMAC encryption.
Handling notifications#
Legacy mutation hooks such as useUpdateAction are replaced by methods on the notification object.
| Method | Replaces | Description |
|---|---|---|
read() | useMarkNotificationAsRead | Marks the notification as read. |
unread() | useMarkNotificationAsUnRead | Marks the notification as unread. |
archive() | No legacy equivalent | Archives the notification. |
unarchive() | No legacy equivalent | Restores an archived notification. |
snooze(snoozeUntil) | No legacy equivalent | Snoozes the notification until an ISO 8601 timestamp. |
unsnooze() | No legacy equivalent | Cancels an active snooze. |
completePrimary() and completeSecondary() | useUpdateAction with MessageActionStatusEnum.DONE | Marks an action button as completed. |
revertPrimary() and revertSecondary() | useUpdateAction with MessageActionStatusEnum.PENDING | Returns an action button to its pending state. |
delete() | No legacy equivalent | Deletes the notification. |
Each method returns a promise, so handle failures rather than assuming the change succeeded.
If you still have questions or need further assistance, please reach out to us at support@novu.co.