Get Component Width & Height


is there any way how to get Vaadin component Width and Height to server-side?

Maybe whole position rect?

I need that because of drawing.

Thanks Miloš

You will need to use either JavaScript or an add-on. The
does exactly that.


The SizeReporter doesn’t have a version for Vaadin 8, so if you’re using 8, here’s a small example of using JavaScript to get the absolute pixel position of a component with defined id of ‘componentId’. It’s rather hacky, and I don’t recommend using these kind of things unless absolutely necessary:

JavaScriptFunction foo = new JavaScriptFunction() {
    public void call(JsonArray arguments) {
        JreJsonNumber top = arguments.get(0);
JavaScript.getCurrent().addFunction("getAbsoluteTop", foo);

Paddings and margins can affect this, so you have to be careful. Hope this helps! Discussion and possible alternative solutions at

BR, Katri