Tobago Demo

Menu

DataAttribute

Add a data attribute to an UIComponent with <tc:dataAttribute/>. The data attribute is added to the parent and can be used by scripts.

Tag Library Documentation

Example

Each box contains a panel with a data attribute. It contains a color code which will be used by a JavaScript which is included into this page. Click in the content area of the boxes to set up a color. Doubleclick to remove it.

<tc:box label="Green">
  <tc:panel>
    <tc:style customClass="demo-data-attribute"/>
    <tc:dataAttribute name="color" value="#00ff00"/>
    ...

Green

Red

Yellow

Blue

© 2005-2025 Apache Software Foundation, Licensed under the Apache License, Version 2.0.