HtmlAttributeHandler | Vaadin

Simple and straightforward way of setting custom html attributes for Vaadin components.

This add-on allows setting and removing custom HTML attributes for any Vaadin Component (to be precise, it sets attributes for a top-level widget that corresponds to that Component).

There are two implementations of HtmlAttributeHandler:

  • ComponentAttributeHandler - sets or removes attributes for any individual Vaadin Component (as a side effect, if that Component does not have an id, it will have one assigned to it at random)
  • ClassAttributeHandler - sets or removes attributes for any number of Vaadin Components that share a style name

There is also a utility class called Autocomplete with static methods "off". As one would guess, it sets "autocomplete = 'off'" for a specified Component or Components that share a style name.

This add-on relies on JavaScript utility class and as such needs JS in the browser. This works only on the client side, so there is no knowledge about the extra attribute in the server-side code. Please note that it is possible to remove or overwrite any HTML attribute, so use it with caution not to break anything. Also, Vaadin may repaint the component in full and as a result remove the custom attributes.


Link to this version
ExperimentalReleased 09 February 2016Apache License 2.0
Framework Support
Vaadin 7.6+
Browser Independent
Install with
Release notes - Version 0.1

Initial version with two implementations of HtmlAttributeHandler and a utility class.