Search code examples
windowvaadintitlevaadin8

Change title of browser window in Vaadin 8


How does one change the title seen in the client web browser window or tab title bar in a Vaadin 8 app?

  • When I set the content of the initial UI with my Layout object, how can I specify a title for that UI’s window?
  • If I open another browser window/tab with another UI, how do I set the title in the native title bar of that window/tab?

Solution

  • Although at the time of this writing the official version listed is 7.7.7 this applies for 8 as well, so as per the documentation, there's a dedicate @Title annotation.

    Vaadin doc version

    Alternatively as Vikrant Thakur's comment is suggesting, you can also use Page.getCurrent().setTitle("whatever") to dynamically update it.

    Below you can see in action a sample based on the default app generated by the Vaadin maven archetype 8.0.0_rc1:

    Vaadin - set page title