Htmlact a206fe6

Htmlact declares dynamic webpages by using HTML data attributes to seamlessly update the page with HTML fragments requested from the server.

Using HTML as the interaction substrate keeps logic on the server and, in the simplest cases, reduces front-end client code to custom CSS animations and an invocation of the Htmlact_page.init function or adding the htmlact-page.js script to your page.

See the quick start and the manual for the full details.

Htmlact was inspired by htmx.


The manual explains it all.

Library htmlact

That's not strictly needed. Only useful if you use Webs and Htmlit.


That's not srictly needed either. Only useful if you already js_of_ocaml based front-end code and want to bundle the page driver with it. You can instead simply add the $(opam var htmlact:share)/htmlact-page.js script to your webpages

Quick start

If you really do not want to write a single line of front-end code, include the page $(opam var htmlact:share)/htmlact-page.js in your page. Now the following:

<script type="text/javascript" defer src="htmlact-page.js"></script>
<button data-request="POST /clicked"
        data-effect="element">Replace me</button>

instructs a click on the button to perform a POST request to /clicked and replace the button with the HTML response. That's it.

If you installed htmlact with tests (opam install -t htmlact). The htamlact-examples binary serves a few interaction examples and links to their sources.

The manual has all the details.