htmx
htmx is a small, dependency-free JavaScript library that extends HTML with attributes. Any element can issue any HTTP verb on any event, and the HTML response is swapped into any target. Your server returns HTML fragments instead of JSON.
Overview
- What it is: ~14 kB, no dependencies, no build step. You add attributes like
hx-getandhx-targetto plain HTML. - Version state: stable line is 2.0.x (current: 2.0.11). htmx 1.x is still maintained at v1.htmx.org for IE11. htmx 4.0 exists only as beta (
v4.0.0-beta6). - Install (one line):
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.11/dist/htmx.min.js"></script>
- Use it when: your app is form-and-list shaped, your server already renders HTML (Go templates, templ, Rails, Django, Phoenix), and you want interactivity without an SPA stack.
- Skip it when: you need rich client state, offline support, complex animations, or a component marketplace. A JS framework earns its keep there.
Source: bigskysoftware/htmx
Contents
- The Hypermedia Model - anchors generalized to any element, event, verb, and target; fragments, not JSON
- Core Attributes - hx-get/hx-trigger/hx-target/hx-swap, indicators, parameters, inheritance
- Server Integration - request and response headers, status-code behavior, OOB swaps, hx-partial, history, security (escaping, hx-disable, CSP, CSRF)
- First Page - a complete Go net/http + html/template app with search and delete
- Common Patterns - active search, delete row, click-to-edit, tabs, lazy load, updating other content
- Resources and Notes - version table, essays worth reading, quirks, theok relevance