This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Dynamically set css' with Vaadin 7

Have you ever tried to add/remove/change style sheets of Vaadin components dynamically, without css file modification? We didn't find suitable methods in Vaadin' standard components.

We miss methods like

setStyle("margins: 2px;");
addStyle("padding-left: 5px;");
removeStyle("padding-left: 5px;");

in Vaadin. It's very easy to change style sheets with css files that are included in your project(s), but if you need a little bit more control... or must create dynamic applications - it's not possible out-of-the-box.

I'm not sure why there are no such methods, because GWT has all of them?

But no worries, with Vaadin 7 it's easy to add support for CSS manipulation. Simply use UI Extensions.

You'll find our CssExtension in our Vaadin UI project.

Leave a Reply

Spam protection by WP Captcha-Free