Directory

← Back

Notification Menu

Notification Menu

Author

Rating

Popularity

200+

Notification Menu. Provides badge counter and actions view all and mark all as read.

Sample code

static final List<NotificationItem> items = new ArrayList<NotificationItem>() {{
    add(new NotificationItem(NotificationType.INFO, "Movie Release", "John Wick 4 is coming soon!"));
    add(new NotificationItem(NotificationType.SUCCESS, "Movie Release", "The Matrix Resurrections is coming soon!"));
}};

final NotificationMenu notificationMenu = new NotificationMenu();
notificationMenu.setItems(items);
        
notificationMenu.addItemClickEventListener(event -> {
    final NotificationItem selectedItem = event.getSelectedItem();
    Notification.show(selectedItem.getDescription(), 5000, Notification.Position.TOP_END).open();
    final int index = items.indexOf(selectedItem);
    items.get(index).markAsRead();
    notificationMenu.setItems(items);
});
        
notificationMenu.addViewAllClickEventListener(event -> {
    Notification.show("Option 'View all' clicked!", 5000, Notification.Position.TOP_END).open();
});
        
notificationMenu.addMarkAllAsReadClickEventListener(event -> {
    Notification.show("Option 'Mark all as read' clicked!", 5000, Notification.Position.TOP_END).open();
    items.forEach(NotificationItem::markAsRead);
    notificationMenu.setItems(items);
});

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

  • Added support for custom icons.
  • Added support for i18n.
  • Added support for max. limit of items.
  • Added methods to hide header, and footer actions.
  • Provides methods to update a subset of items.
Released
2023-04-25
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 14
Vaadin 22
Vaadin 23
Browser
Firefox
Safari
Google Chrome

Notification Menu - Vaadin Add-on Directory

Notification Menu Notification Menu - Vaadin Add-on Directory
Notification Menu. Provides badge counter and actions view all and mark all as read.
Online