Directory

← Back

Country Flag Add-on

A component which shows a SVG flag of a country

Author

Rating

Popularity

200+

A Vaadin component which shows a SVG flag of given country. It uses the Flag Icon CSS project. The flags are self-hosted in the add-on jar file, so the flags are not downloaded from some third-party server. No widgetset compilation needed. The jar itself is 2mb in size.

Please specify the country code as a lower-case ISO 3166-1-alpha-2 code; you can browse the country codes here: https://www.iso.org/obp/ui/#search

Sample code

public class DemoUI extends UI
{

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = DemoUI.class)
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        final HorizontalLayout layout = new HorizontalLayout();
        layout.setStyleName("demoContentLayout");
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.addComponents(h1("Ice hockey: 1:1"), new CountryFlag("fi"), h1("vs"), new CountryFlag("se"));
        setContent(layout);
    }

    private static Label h1(String text) {
        final Label label = new Label(text);
        label.addStyleName(ValoTheme.LABEL_H1);
        return label;
    }
}

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

Released
2017-05-29
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Browser
Firefox
Opera
Safari
Google Chrome
iOS Browser
Android Browser
Internet Explorer
Windows Phone
Microsoft Edge

Country Flag Add-on - Vaadin Add-on Directory

A component which shows a SVG flag of a country Country Flag Add-on - Vaadin Add-on Directory
A Vaadin component which shows a SVG flag of given country. It uses the [Flag Icon CSS](https://github.com/lipis/flag-icon-css) project. The flags are self-hosted in the add-on jar file, so the flags are not downloaded from some third-party server. No widgetset compilation needed. The jar itself is 2mb in size. Please specify the country code as a lower-case ISO 3166-1-alpha-2 code; you can browse the country codes here: [https://www.iso.org/obp/ui/#search](https://www.iso.org/obp/ui/#search)
Online