datastar_gleam/lustre
Values
pub fn attr(
name: String,
expression: String,
) -> attribute.Attribute(a)
data-attr:disabled="$condition"
Toggle an HTML attribute based on a signal expression.
pub fn bind(key: String) -> attribute.Attribute(a)
data-bind:key
Two-way bind the element’s value to the signal named key.
pub fn class(expression: String) -> attribute.Attribute(a)
data-class="{ 'class-name': $condition }"
Toggle CSS classes based on a signal expression.
pub fn on_get(path: String) -> attribute.Attribute(a)
data-on:click="@get('/path')"
Trigger a GET request to path when the element is clicked.
pub fn on_post(path: String) -> attribute.Attribute(a)
data-on:click="@post('/path')"
Trigger a POST request to path when the element is clicked.
pub fn signal(
key: String,
value: String,
) -> attribute.Attribute(a)
data-signals:key="value"
Initialise a reactive signal with the given key and value.
pub fn text(key: String) -> attribute.Attribute(a)
data-text="$key"
Set the element’s text content to the value of the signal key.