How to execute Javascript after Component is rendered in client browser

i got a custom component as a div with a class=“x”. On the other hand i got a JavaScript library which changes the appeareance/ behaviour of my component. To do so i need to fire a function of the library with the class “x” as input (after page is loaded).

The concept implementation would look something like this:

Div customElem = new Div();


//Execute the following when element is loaded on client side
ui.access(() -> ui.getPage().executeJs("runLibraryFunction('x')"));

Is there a way i can do this in Vaadin (Version 14)?

Hi Jonas. Please take a look at [this tutorial]
( and also see the comments because there are some changes in V14 for this. The tutorial is being updated to 14 but I don’t know when it will be live.

Sadly this could not solve my specific problem :confused: