Customizing Notification Center
Learn how to customize the pre built notification center component partially or building your own notification center component from scratch using Novu provided hooks
PopoverNotificationCenter Customization
<PopoverNotificationCenter>
is a pre built notification center component that can be used to show notifications in your application. It is a popover component that can be placed anywhere in your application. A bell will appear on the page. On click of that bell, a popover will appear. Checkout all customizations and available props. If you are looking for a component without popover use regular <NotificationCenter>
component. Checkout props of this component. Few selected customization options are explained below:-
Implementing custom bell icon
It is common that you might have a special set of icons you use within your application and you will want to replace the default: NotificationBell
coming from our library.
For this you can easily switch the NotificationBell
with your own bell. Just make sure you pass the unseenCount
param inside and use it accordingly.
Dark mode support
To support dark mode in your application the notification center component can receive a colorScheme
prop that can receive either dark
or light
mode.
Popover positioning
Use position
and offset
prop to position the popover relative to the Bell icon
Header, Footer and Empty state
Use header
, footer
and emptyState
prop to customize the header, footer and empty state of notification center.
Notification item
Use the listItem prop to show custom notification items.
Customize the UI language
If you want to use a language other than english for the UI, the NovuProvider
component can accept an optional i18n
prop.
The i18n
prop can accept 2 different types of values
- 2 letter language string
- Translation object
en
as the default value for i18nCustomization using styles
prop
styles
prop can be used to cutomise styling of each component of notification center. Read more about styles prop
Customization Using Hooks
If you don’t want to use our pre built component then, you can build your own notification center using hooks. @novu/notification-center
react package provides many hooks like useNotifications
, useFetchNotifications
, useUpdateUserPreferences
. Checkout all available hooks. All the hooks should be defined inside the NovuProvider component. Most of the hooks are based on the @tanstack/react-query
library.
Checkout below example on how to use useNotifications
and useFetchNotifications
hook
Was this page helpful?