Skip to content

Vaadin 8 | Badges

appreciated edited this page Jun 25, 2018 · 1 revision

Badges are additional Labels that are meant to show a number but actually can also be used for other Strings but you will have to comeup with you on BadgeHolder implementation. Badges can be used to indicate changes to the user inside one or multiple of your views. Badges can be added to the Sidemenu but also to the AppBar (top bar).

public class DemoUI extends UI {
    DefaultBadgeHolder badge = new DefaultBadgeHolder();

    @Override
    protected void init(VaadinRequest request) {
        AppLayout drawer = AppLayoutBuilder.get(variant)
                ...
                .add("Home", VaadinIcons.HOME, badge, new View1())
                ...
                .build();
        setContent(drawer);
    }
}