htmx - high power tools for HTML
  • JavaScript 92%
  • HTML 7.1%
  • CSS 0.4%
  • TypeScript 0.3%
  • Ruby 0.1%
Find a file
Carson Gross d496430afd fix image
2026-03-19 14:22:57 -06:00
.github Merge branch 'master' into v2.0v2.0 2024-01-23 12:49:02 -07:00
dist prep 2.0.8 release 2025-10-24 20:42:29 -06:00
editors/jetbrains prep 2.0.8 release 2025-10-24 20:42:29 -06:00
scripts Automatically generate Web Types for the package based on current documentation (#3071) 2025-06-02 11:25:23 -06:00
src Include target selector in htmx:oobErrorNoTarget event and error log (#3644) 2026-02-03 12:48:58 -07:00
test Include target selector in htmx:oobErrorNoTarget event and error log (#3644) 2026-02-03 12:48:58 -07:00
www fix image 2026-03-19 14:22:57 -06:00
.gitignore Update testing framework to web-test-runner and improve code coverage (#3273) 2025-04-17 17:55:43 -06:00
CHANGELOG.md fix the title fix 2025-10-24 21:07:28 -06:00
CONTRIBUTING.md Correct lint command in contribution guidelines (#2950) 2024-10-08 08:51:36 +02:00
LICENSE change license to 0 clause BSD 2024-01-15 06:03:09 -07:00
netlify.toml Bump Zola version to 0.19.1 (#2739) 2024-07-17 22:07:07 -06:00
package-lock.json Update Node Versions and types to fix latest tsc upgrade issues (#3455) 2025-10-14 05:19:20 -06:00
package.json prep 2.0.8 release 2025-10-24 20:42:29 -06:00
README.md prep 2.0.8 release 2025-10-24 20:42:29 -06:00
SECURITY.md Create SECURITY.md (#3288) 2025-04-24 13:41:47 -06:00
TESTING.md Fix variable names (#3344) 2025-07-14 17:38:39 -06:00
web-test-runner.config.mjs update web test-runner and remove temp summaryReporter workaournd (#3320) 2025-05-22 07:17:16 +02:00

</> htmx

high power tools for HTML

Discord Netlify Bundlephobia Bundlephobia

introduction

htmx allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext

htmx is small (~14k min.gz'd), dependency-free & extendable

motivation

  • Why should only <a> and <form> be able to make HTTP requests?
  • Why should only click & submit events trigger them?
  • Why should only GET & POST be available?
  • Why should you only be able to replace the entire screen?

By removing these arbitrary constraints htmx completes HTML as a hypertext

quick start

  <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js"></script>
  <!-- have a button POST a click via AJAX -->
  <button hx-post="/clicked" hx-swap="outerHTML">
    Click Me
  </button>

The hx-post and hx-swap attributes tell htmx:

"When a user clicks on this button, issue an AJAX request to /clicked, and replace the entire button with the response"

htmx is the successor to intercooler.js

installing as a node package

To install using npm:

npm install htmx.org --save

Note there is an old broken package called htmx. This is htmx.org.

website & docs

contributing

Want to contribute? Check out our contribution guidelines

No time? Then become a sponsor

hacking guide

To develop htmx locally, you will need to install the development dependencies.

Run:

npm install

Then, run a web server in the root.

This is easiest with:

npx serve

You can then run the test suite by navigating to:

http://0.0.0.0:3000/test/

At this point you can modify /src/htmx.js to add features, and then add tests in the appropriate area under /test.

  • /test/index.html - the root test page from which all other tests are included
  • /test/attributes - attribute specific tests
  • /test/core - core functionality tests
  • /test/core/regressions.js - regression tests
  • /test/ext - extension tests
  • /test/manual - manual tests that cannot be automated

htmx uses the mocha testing framework, the chai assertion framework and sinon to mock out AJAX requests. They are all OK.

haiku

javascript fatigue:
longing for a hypertext
already in hand