data method

ElementBuilder data(
  1. String key,
  2. String value
)

Sets a custom data attribute.

Example:

Div().data('user-id', '123')  // data-user-id="123"
Div().data('count', '42')  // data-count="42"

Implementation

ElementBuilder data(String key, String value) {
  attr('data-$key', StringAttribute(value));
  return this;
}