Search code examples
htmlradio-buttonvaadinradiobuttonlist

Vaadin radio buttons, horizontal rather than stacked vertical


I want to display my radio buttons in 1 line such as:

◎ Option1     ◉ Option2

However with Vaadin I cannot accomplish this it seems like the following,

◎ Option1

◉ Option2

here is my code:

final List<String> options = Arrays.asList(new String[] {
                "hebele", "hubele"});
        
        final OptionGroup group = new OptionGroup("", options);
        
        group.setNullSelectionAllowed(false); // user can not 'unselect'
        group.select("hubele"); // select this by default

How can i change this?


Solution

  • As explained in the The Book of Vaadin, you've got to define a theme to setup your own style.css file.

    Then you can override the default style for the option to be displayed inline as follow:

    .v-app .v-select-optiongroup .v-select-option {
        display:inline;
    }