AttributesBuilder

DSL for building attributes.

Data attributes can be set using the attributes builder:

fun Html.Counter() {
val count = signal(0)
button(
onClick = { count.value++ },
data = { "is-even" with count { it % 2 == 0 } } // Sets the data-is-even attribute
) {
text(count { "Count: $it" })
}
}

Since

0.2.0

Functions

Link copied to clipboard
infix fun String.with(value: Signal<Boolean>)

Assigns the given boolean value to the attribute.

infix fun String.with(value: Signal<String?>)

Assigns the given value to the attribute.