High power tools for HTML
open source0BSDfree
htmx is a small (about 16 KB minified and gzipped), dependency-free JavaScript library that gives HTML attributes the power to make AJAX requests, swap parts of the page with the HTML the server returns, run CSS transitions and use WebSockets and Server-Sent Events, so server-rendered apps get modern interactivity without a JavaScript framework. Any element can issue a GET, POST, PUT, PATCH or DELETE on any event (hx-post, hx-swap and the rest), and the server answers with HTML, from any backend language. It's the successor to intercooler.js and is extendable. htmx 4.0 is released, but npm still marks the 2.x line as latest until 2027; htmx 2 dropped Internet Explorer, which the 1.x line still supports.
Problems it solves
- add interactivity to server-rendered pages without React
- update part of a page from the server without writing JavaScript
- build a dynamic web app with Django or Rails templates and no SPA
- swap HTML fragments over AJAX with attributes
Features
- AJAX from any element on any event
- partial page swaps with server HTML
- CSS transitions
- WebSockets and Server-Sent Events
- about 16 KB, no dependencies
- extensions
Capabilities
| Takes plugins | plan not known |
|---|
Alternatives
The same job
These do what htmx does.
- Turbo The speed of a single-page web application without having to write any JavaScript
- Stimulus A modest JavaScript framework for the HTML you already have
- Hotwire HTML over the wire
- Alpine.js Your new, lightweight, JavaScript framework
- Phoenix LiveView Rich, real-time user experiences with server-rendered HTML
- Inertia.js Build frontend experiences with the backend you love