StyleableOptionGroup extends the OptionGroup of the core framework by allowing style names for each item.
StyleableOptionGroup radioButtons = new StyleableOptionGroup();
radioButtons.addItem("red");
radioButtons.addItem("green");
radioButtons.addItem("blue");
radioButtons.setItemStyleName("red", "red");
radioButtons.setItemStyleName("green", "green");
radioButtons.setItemStyleName("blue", "blue");
.v-select-optiongroup {
.v-select-option {
&.red {
color: desaturate(red, 25%);
}
&.green {
color: desaturate(green, 25%);
}
&.blue {
color: desaturate(blue, 25%);
}
}
}
Try the add-on demo at http://teemu.app.fi/StyleableOptionGroup
Official releases of this add-on are available at Vaadin Directory. For Maven instructions, download and reviews, go to https://vaadin.com/addon/styleable-optiongroup
mvn clean install
cd demo
mvn jetty:run
To see the demo, navigate to http://localhost:8080/
Add-on is distributed under Apache License 2.0. For license terms, see LICENSE.txt.
StyleableOptionGroup is written by Teemu Pöntelin.