Version: v0.7.0 - Beta.  We welcome contributors & feedback.


Web.htmx($mode, $dataMap) -> HtmlString


Create HTML parameters for making an Ajax call using the HTMX JavaScript framework.

This will set up a POST request to the current page with the given data.

tm linkHtml {
    --- $htmx = Web.htmx('getThing', { id: 123 })
    <a {{ $htmx }} hx-target="#somediv"> Get Thing

Mode Function

The $mode defines which mode function will be called for the Ajax response.

You will usually want to return an HTML TypeString, which will replace the hx-target.

fn getThingMode {
    $id ='id')
    return thingHtml($id)

tm thingHtml($id) {
    <.thing> Thing {{ $id }}

To see how “hx-” parameters work, see HTMX parameters.

Including the HTMX Library

You will need to include the HTMX library on the client-side.

For example:

$page = Page.create({
    js: [url''],

See Also