HTML authoring is the most direct way to learn Slim.
Instead of introducing a custom compiler first, you write regular HTML and add Xuda directives that bind fields, compute output, toggle visibility, run actions, or iterate over data.
Why teams choose HTML authoring
- the DOM stays visually readable
- designers and frontend developers can inspect the output directly
- examples and docs remain close to what the browser renders
- small reactive surfaces are easy to prototype
Mental model
Think of Slim HTML as:
- normal HTML for structure
- datasource fields for state
@field_nameexpressions for reads- Xuda directives for wiring behavior
Minimal example:
<div xu-store="{'headline':'Hello Xuda'}">
<input xu-bind="headline" />
<h1 xu-exp:xu-content="@headline"></h1>
</div>
Common HTML directives
xu-storeSeed a small local data shape directly on the node.xu-bindBind input state to a field.xu-text,xu-html,xu-contentPush output into the DOM.xu-exp:*Compute attributes or values from expressions.xu-clickHandle a simple click update quickly.xu-on:*Attach full workflow payloads.xu-forRepeat nodes from a collection.xu-showandxu-renderHide vs remove nodes conditionally.
When HTML authoring is the better fit
Use it for:
- docs pages
- microsites
- product landing pages
- embedded widgets
- hand-authored prototypes
Move to CLI source files when:
- the app grows into multiple routed features
- persistence logic needs a clearer home
- multiple unit types such as
get_data,set_data, andbatchshould live outside the page - the team wants a stronger project structure