API reference for the @novu/react package

Components

The @novu/react package provides React components for building notification UIs.

Inbox

The main component for displaying notifications.

Props

PropTypeDefault
applicationIdentifier?
string
-
subscriberId?
string
-
subscriberHash?
string
-
backendUrl?
string
-
socketUrl?
string
-
appearance?
Appearance
-
localization?
Localization
-
tabs?
Tab[]
-
preferencesFilter?
PreferencesFilter
-
routerPush?
RouterPush
-

Usage

import { Inbox } from '@novu/react';
 
function NotificationCenter() {
  return (
    <Inbox
      applicationIdentifier="YOUR_APP_ID"
      subscriberId="USER_ID"
      backendUrl="https://api.novu.co"
      socketUrl="https://ws.novu.co"
      placement="right"
      placementOffset={10}
      onNotificationClick={(notification) => {
        // Handle notification click
        console.log(notification);
      }}
    />
  );
}

Appearance Configuration

PropTypeDefault
variables?
Variables
-
animations?
boolean
-
baseTheme?
Theme | Theme[]
-

Variables

PropTypeDefault
colorBackground?
string
-
colorForeground?
string
-
colorPrimary?
string
-
colorPrimaryForeground?
string
-
colorSecondary?
string
-
colorSecondaryForeground?
string
-
colorCounter?
string
-
colorCounterForeground?
string
-
colorNeutral?
string
-
colorShadow?
string
-
fontSize?
string
-
borderRadius?
string
-

Elements

PropTypeDefault
button?
ElementStyles
-
popoverContent?
ElementStyles
-
popoverTrigger?
ElementStyles
-
dropdownContent?
ElementStyles
-
dropdownTrigger?
ElementStyles
-
dropdownItem?
ElementStyles
-
dropdownItemLabel?
ElementStyles
-
dropdownItemLabelContainer?
ElementStyles
-
dropdownItemLeftIcon?
ElementStyles
-
dropdownItemRightIcon?
ElementStyles
-
tooltipContent?
ElementStyles
-
tooltipTrigger?
ElementStyles
-
back__button?
ElementStyles
-
skeletonText?
ElementStyles
-
skeletonAvatar?
ElementStyles
-
tabsRoot?
ElementStyles
-
tabsList?
ElementStyles
-
tabsContent?
ElementStyles
-
tabsTrigger?
ElementStyles
-
dots?
ElementStyles
-
root?
ElementStyles
-
bellIcon?
ElementStyles
-
bellContainer?
ElementStyles
-
bellDot?
ElementStyles
-
preferences__button?
ElementStyles
-
preferencesContainer?
ElementStyles
-
inboxHeader?
ElementStyles
-
loading?
ElementStyles
-
inboxContent?
ElementStyles
-
inbox__popoverTrigger?
ElementStyles
-
inbox__popoverContent?
ElementStyles
-
notificationListContainer?
ElementStyles
-
notificationList?
ElementStyles
-
notificationListEmptyNoticeContainer?
ElementStyles
-
notificationListEmptyNotice?
ElementStyles
-
notificationListEmptyNoticeIcon?
ElementStyles
-
notificationListNewNotificationsNotice__button?
ElementStyles
-
notification?
ElementStyles
-
notificationDot?
ElementStyles
-
notificationSubject?
ElementStyles
-
notificationSubject__strong?
ElementStyles
-
notificationBody?
ElementStyles
-
notificationBody__strong?
ElementStyles
-
notificationBodyContainer?
ElementStyles
-
notificationImage?
ElementStyles
-
notificationDate?
ElementStyles
-
notificationDefaultActions?
ElementStyles
-
notificationCustomActions?
ElementStyles
-
notificationPrimaryAction__button?
ElementStyles
-
notificationSecondaryAction__button?
ElementStyles
-
notificationRead__button?
ElementStyles
-
notificationUnread__button?
ElementStyles
-
notificationArchive__button?
ElementStyles
-
notificationUnarchive__button?
ElementStyles
-
notificationsTabs__tabsRoot?
ElementStyles
-
notificationsTabs__tabsList?
ElementStyles
-
notificationsTabs__tabsContent?
ElementStyles
-
notificationsTabs__tabsTrigger?
ElementStyles
-
notificationsTabsTriggerLabel?
ElementStyles
-
notificationsTabsTriggerCount?
ElementStyles
-
inboxStatus__title?
ElementStyles
-
inboxStatus__dropdownTrigger?
ElementStyles
-
inboxStatus__dropdownContent?
ElementStyles
-
inboxStatus__dropdownItem?
ElementStyles
-
inboxStatus__dropdownItemLabel?
ElementStyles
-
inboxStatus__dropdownItemLabelContainer?
ElementStyles
-
inboxStatus__dropdownItemLeft__icon?
ElementStyles
-
inboxStatus__dropdownItemRight__icon?
ElementStyles
-
moreActionsContainer?
ElementStyles
-
moreActions__dropdownTrigger?
ElementStyles
-
moreActions__dropdownContent?
ElementStyles
-
moreActions__dropdownItem?
ElementStyles
-
moreActions__dropdownItemLabel?
ElementStyles
-
moreActions__dropdownItemLeft__icon?
ElementStyles
-
moreActions__dots?
ElementStyles
-
moreTabs__button?
ElementStyles
-
moreTabs__dots?
ElementStyles
-
moreTabs__dropdownTrigger?
ElementStyles
-
moreTabs__dropdownContent?
ElementStyles
-
moreTabs__dropdownItem?
ElementStyles
-
moreTabs__dropdownItemLabel?
ElementStyles
-
moreTabs__dropdownItemRight__icon?
ElementStyles
-
workflowContainer?
ElementStyles
-
workflowLabel?
ElementStyles
-
workflowLabelHeader?
ElementStyles
-
workflowLabelContainer?
ElementStyles
-
workflowContainerDisabledNotice?
ElementStyles
-
workflowLabelDisabled__icon?
ElementStyles
-
workflowContainerRight__icon?
ElementStyles
-
workflowArrow__icon?
ElementStyles
-
channelContainer?
ElementStyles
-
channelsContainerCollapsible?
ElementStyles
-
channelsContainer?
ElementStyles
-
channelLabel?
ElementStyles
-
channelLabelContainer?
ElementStyles
-
channelDescription?
ElementStyles
-
channelName?
ElementStyles
-
channelSwitchContainer?
ElementStyles
-
channelSwitch?
ElementStyles
-
channelSwitchThumb?
ElementStyles
-
preferencesHeader?
ElementStyles
-
preferencesHeader__back__button?
ElementStyles
-
preferencesHeader__title?
ElementStyles
-
preferencesLoadingContainer?
ElementStyles
-
strong?
ElementStyles
-

Bell

A customizable notification bell component.

Props

PropTypeDefault
renderBell?
BellRenderer
-

Usage

import { Bell } from '@novu/react';
import { BellIcon } from 'lucide-react';
 
function NotificationBell() {
  return (
    <Bell
      renderBell={(unreadCount) => (
        <div className="relative">
          <BellIcon className="h-6 w-6" />
          {unreadCount > 0 && (
            <span className="absolute -top-1 -right-1 bg-red-500 text-white rounded-full w-5 h-5 text-xs flex items-center justify-center">
              {unreadCount}
            </span>
          )}
        </div>
      )}
    />
  );
}

Notifications

A component for rendering a list of notifications.

Props

PropTypeDefault
renderNotification?
NotificationsRenderer
-
onNotificationClick?
NotificationClickHandler
-
onPrimaryActionClick?
NotificationActionClickHandler
-
onSecondaryActionClick?
NotificationActionClickHandler
-

Usage

import { Notifications } from '@novu/react';
 
function NotificationList() {
  return (
    <Notifications
      onNotificationClick={(notification) => {
        // Handle notification click
        console.log(notification);
      }}
      renderNotification={({ content, createdAt }) => (
        <div className="flex gap-2 p-2">
          <div className="flex-1">
            <p>{content}</p>
            <time className="text-sm text-gray-500">
              {new Date(createdAt).toLocaleDateString()}
            </time>
          </div>
        </div>
      )}
    />
  );
}

InboxContent

A component for building custom notification inboxes.

Props

PropTypeDefault
renderNotification?
NotificationsRenderer
-
onNotificationClick?
NotificationClickHandler
-
onPrimaryActionClick?
NotificationActionClickHandler
-
onSecondaryActionClick?
NotificationActionClickHandler
-
initialPage?
InboxPage
-
hideNav?
boolean
-

Usage

import { InboxContent } from '@novu/react';
 
function CustomInbox() {
  return (
    <div className="custom-inbox-wrapper">
      <InboxContent
        onNotificationClick={(notification) => {
          // Handle notification click
          console.log(notification);
        }}
        onPrimaryActionClick={(notification, action) => {
          // Handle primary action click
          console.log(notification, action);
        }}
        hideNav={false}
        renderNotification={({ content, createdAt }) => (
          <div className="notification-item">
            <p>{content}</p>
            <time>{new Date(createdAt).toLocaleDateString()}</time>
          </div>
        )}
      />
    </div>
  );
}

On this page