diff --git a/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx b/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx
index 53e04494c1..d9440af62e 100644
--- a/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx
+++ b/plugins/notifications/src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx
@@ -99,6 +99,19 @@ export type NotificationSnackbarProperties = {
};
};
+/**
+ * Props passed to the custom renderItem function
+ * @public
+ */
+export type NotificationsRenderItemProps = {
+ /** Current unread notification count */
+ unreadCount: number;
+ /** Route path to the notifications page */
+ to: string;
+ /** Click handler that requests web notification permission */
+ onClick: () => void;
+};
+
/**
* @public
*/
@@ -119,6 +132,12 @@ export type NotificationsSideBarItemProps = {
text?: string;
disableHighlight?: boolean;
noTrack?: boolean;
+ /**
+ * Optional render function to provide custom UI instead of the default SidebarItem.
+ * When provided, allows placing the notification indicator anywhere (e.g., header).
+ * The default SidebarItem will not be rendered when this prop is used.
+ */
+ renderItem?: (props: NotificationsRenderItemProps) => React.ReactNode;
};
/** @public */
@@ -304,6 +323,20 @@ export const NotificationsSidebarItem = (
const count = !error && !!unreadCount ? unreadCount : undefined;
+ const handleClick = useCallback(() => {
+ requestUserPermission();
+ }, [requestUserPermission]);
+
+ // Props to pass to custom renderItem function
+ const renderItemProps: NotificationsRenderItemProps = useMemo(
+ () => ({
+ unreadCount,
+ to: notificationsRoute,
+ onClick: handleClick,
+ }),
+ [unreadCount, notificationsRoute, handleClick],
+ );
+
return (
<>
{snackbarEnabled && (
@@ -336,17 +369,19 @@ export const NotificationsSidebarItem = (
}}
/>
)}
- {
- requestUserPermission();
- }}
- text={text}
- icon={icon}
- {...restProps}
- >
- {count && 99 ? '99+' : count} />}
-
+ {props?.renderItem ? (
+ props.renderItem(renderItemProps)
+ ) : (
+
+ {count && 99 ? '99+' : count} />}
+
+ )}
>
);
};