Open manolo opened 6 years ago
Any news on this? A dismissible notification is a very common use case. Here's a workaround code snippet:
Notification notification = new Notification();
notification.addThemeVariants(NotificationVariant.LUMO_PRIMARY);
notification.setPosition(Notification.Position.TOP_CENTER);
HorizontalLayout notificationContent = new HorizontalLayout(
new Label("Horizontal layout with a label with some misc text and "
+ "a Vaadin icon with a click listener to close the notification."),
new Button(VaadinIcon.CLOSE_SMALL.create(), e -> notification.close())
);
notificationContent.setAlignItems(Alignment.CENTER);
notification.add(notificationContent);
notification.open();
The special case for dismiss button is cover in vaadin/web-components#438
But we might still want another convenience API for adding an action button, for example, an “Undo” button, in addition to the dismiss button.
Something like: Vaadin.Notification.createAction('Foo Bar Baz', callback)
Related with vaadin/vaadin-notification#18