Skip to main content
The @novu/react package introduces a more flexible and customizable way to display notifications in your application. This guide outlines the key differences between the @novu/notification-center package and the new @novu/react package. Follow the steps below to migrate your application to the latest Inbox version.

Why you should upgrade to @novu/react

  • Customization: The @novu/react package provides more customization options for the appearance and behavior of the notification components.
  • Flexibility: The new package offers more flexibility in handling notifications and integrating with third-party libraries.
  • Performance: It is optimized for performance and provides a smoother user experience.
  • Bundle Size: The new package has a smaller bundle size and improved tree-shaking capabilities.
  • Compatibility with the @novu/framework: The @novu/react package is designed to work seamlessly with the @novu/framework package for creating and managing notifications.

Breaking Changes

The @novu/react package introduces several breaking changes compared to the @novu/notification-center package. Here are the key differences:

Components

  • The PopoverNotificationCenter component has been replaced with the Inbox component.
  • The NotificationCenter component has been replaced with the Notifications component.
  • The NotificationBell component has been replaced with the Bell component.

Styling

  • The styles prop is replaced by an enhanced, easy to use appearance prop to customize the notification components. For more information on appearance customization, visit here.

Notification

  • Removal of seen , lastSeenDate, content, templateIdentifier, payload, cta properties from the Notification object.
  • We have introduced archive functionality to the Notification object.
Notification object
Types

Getting started

To begin, install the @novu/react package.

Basic usage

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

  1. Define multiple workflows with relevant tags.
Add tags on the workflow Tags field. One tag can be used for multiple workflows.
  1. Use those tags in the tabs prop of the Inbox component.

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

Handle notifications using the methods provided by the notification object.

Marking notifications as read

Mark notifications as read using the read method provided by the notification object.

Marking notifications as unread

Mark notifications as unread using the unread method provided by the notification object.

Marking notifications as archive

Mark notifications as archive using the archive method provided by the notification object.

Marking notifications as unarchive

Mark notifications as unarchive using the unarchive method provided by the notification object.
If you still have questions or need further assistance, please reach out to us at support@novu.co.