Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

htmx

> 前端框架
Open source

</> htmx - high power tools for HTML

48.9K stars0 likes6 views
WebsiteGitHub

About

</> htmx - high power tools for HTML

high power tools for HTML

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

xml
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/htmx.min.js"    
          integrity="sha384-H5SrcfygHmAuTDZphMHqBJLc3FhssKjG7w/CeCpFReSfwBWDTKpkzPP8c+cLsK+V" 
          crossorigin="anonymous"></script>
  
  <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:

bash
npm install htmx.org --save

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

website & docs

  • https://htmx.org
  • https://htmx.org/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:

bash
npm install

Then, run a web server in the root.

This is easiest with:

bash
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

Issues· 275 open

View all issuesOpen on GitHub
  • #4108

    Title: metaCharacter silently renames dispatched event names, but is documented as scoping to attribute modifiers only — and logAll still logs the old names

    Updated Sep 27, 2026
  • #4104

    implicitInheritance also inherits hx-get, hx-post and hx-trigger, which htmx 2 never inherited

    Updated Sep 25, 2026
  • #4095

    Issues with head extension defer behavior

    Updated Sep 24, 2026
  • #4103

    Upgrade guide maps htmx:load and htmx:afterOnLoad to htmx:after:init, which fires at different times

    Updated Sep 24, 2026
  • #4101

    A response whose target has left the page still sets the title and merges the head

    Updated Sep 24, 2026
  • #4100

    hx-head: a merge that removes a stylesheet another merge is waiting for leaves that swap hanging

    Updated Sep 24, 2026
  • #4072

    HTMX 4 hx-sse:connect gets stuck while trying to reconnect when server is down

    Updated Sep 24, 2026
  • #4070

    head extension mishandles title

    Updated Sep 23, 2026
  • #3966

    hx-boost="true" and hx-push-url="false" not working for anchor URL in v2.0.10

    Updated Sep 22, 2026
  • #3340

    on Chrome, htmx-swap via <button> scrolls to bottom of page if any <select> is present

    Updated Sep 22, 2026

> Tags

JavaScripthateoashtmlhtmxhyperscript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架