Skip to content

HTMX.jl

HTMX.jl provides a Julia interface for building HTMX-powered HTML using a hyperscript-like syntax backed by Cobweb.jl.

Basic usage

Use h.tagname(...) to create HTML nodes:

julia
h.div(class="container")(
    h.h1("Hello, HTMX!"),
    h.p("This is a paragraph.")
)

Hyperscript syntax

The @__str macro (via _"...") lets you embed Hyperscript behavior strings directly in nodes:

julia
h.button(
    _"""on click toggle .hidden on #menu""",
    "Toggle menu"
)

auto helper

auto converts arbitrary values to HTML fragments. It handles strings, arrays, and Pairs (for out-of-band HTMX swaps):

julia
auto("raw html string"; wrap=identity)
julia
auto(["<li>one</li>", "<li>two</li>"]; wrap=identity)
You are viewing the dev branch. This branch may include code written with Claude Code with less human supervision. Only human-approved code is merged into main.