Class Data


@Bean(typeName="data") public class Data extends HtmlElementMixed
DTO for an HTML <data> element.

The data element represents its contents, along with a machine-readable form of those contents in the value attribute. It is used to provide both human-readable and machine-readable versions of the same data, making it easier for scripts and other automated systems to process the information while still displaying meaningful content to users. The value attribute should contain the machine-readable version of the data.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple data element Data simple = data("12345", "Product #12345"); // Data with styling Data styled = data("USD", "US Dollar") ._class("currency"); // Data in a sentence P sentence = p( "Price: ", data("29.99", "$29.99"), " per item" ); // Data with complex content Data complex = data("2024-01-15", "January 15, 2024", span()._class("date").children(" (Monday)") ); // Data with multiple attributes Data multiple = data("SKU-12345", "SKU: 12345") ._class("product-sku") .title("Product SKU"); // Data with ID Data withId = data("user-123", "User ID: 123") .id("user-id") .children("User ID: 123"); // Data with styling Data styled2 = data("active", "Active") .style("color: green; font-weight: bold;");

The following convenience methods are provided for constructing instances of this bean:

See Also: