Directives are how Slim turns plain markup or runtime nodes into a reactive Xuda surface.
State and output
xu-storeSeed local state quickly.xu-bindConnect an input to a field.xu-textRender plain text.xu-htmlRender HTML intentionally.xu-contentGeneric content setter.
Expressions
Use xu-exp:* when an attribute or value should be computed from a field expression.
Examples:
xu-exp:xu-contentxu-exp:placeholderxu-exp:classxu-exp:titlexu-exp:xu-showxu-exp:xu-render
Expressions read field values with the @field_name syntax.
Events and workflows
xu-clickGood for simple click-driven updates.xu-on:*Use for richer workflow payloads or event wiring.
Example:
<button
xu-on:click='[
{
"handler": "custom",
"workflow": [
{
"data": {
"action": "update",
"name": { "value": "@count_v: @count_v + 1" },
"enabled": true
}
}
]
}
]'
>
Increment
</button>
Iteration and conditional rendering
xu-forRepeat a node for every item in a list.xu-for-keyName the iteration index or key.xu-for-valName the current item.xu-showHide the node while keeping it mounted.xu-renderRemove the node when the condition is false.
Practical rule
Use the smallest directive that matches the need.
- simple output:
xu-textorxu-content - simple click updates:
xu-click - full workflow logic:
xu-on:* - computed attrs:
xu-exp:* - structural behavior:
xu-for,xu-render,xu-show