Syntax Style Guide

They say if you're going to do something, do it with style—and we believe that applies to coding as well. HTMX's strength lies in its preference for attributes over coding, though this can be a bit overwhelming at first. To enhance readability, we recommend adopting the following syntax style.

<a class="btn btn-primary btn-xs"
    hx-post="^/cato/link-client?ClientGuid={{ client.Guid }}&OrganizationGuid={{ organization.Guid }}"
    hx-target="closest .unlinked-client"
    hx-swap="outerHTML swap:1s"
    hx-swap="outerHTML">{{ organization.Name }}</a>

Note the following:

  1. Put one attribute per line.

  2. The first attribute should be for CSS style classes.

Last updated