Directory

← Back

HtmlAttributeHandler

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

Author

Rating

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.

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

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

Released
2016-02-09
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.6+
Browser
Browser Independent

HtmlAttributeHandler - Vaadin Add-on Directory

Simple and straightforward way of setting custom html attributes for Vaadin components. HtmlAttributeHandler - Vaadin Add-on Directory
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.
Online