MCPcopy
hub / github.com/bigskysoftware/htmx

github.com/bigskysoftware/htmx @v2.0.10 sqlite

repository ↗ · DeepWiki ↗ · release v2.0.10 ↗
1,156 symbols 4,286 edges 115 files 727 documented · 63%
README

</> 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.10/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:

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*

Core symbols most depended-on inside this repo

matchToken
called by 601
www/themes/htmx-theme/static/js/_hyperscript.js
make
called by 532
test/util/util.js
make
called by 527
www/static/test/util/util.js
make
called by 483
test/core/shadowdom.js
make
called by 476
www/static/test/core/shadowdom.js
requireElement
called by 335
www/themes/htmx-theme/static/js/_hyperscript.js
byId
called by 285
test/core/shadowdom.js
byId
called by 285
test/util/util.js

Shape

Function 974
Method 154
Class 28

Languages

TypeScript100%

Modules by API surface

www/themes/htmx-theme/static/js/htmx.js201 symbols
www/static/src/htmx.js201 symbols
src/htmx.js201 symbols
www/themes/htmx-theme/static/js/_hyperscript.js194 symbols
www/static/test/lib/_hyperscript.js128 symbols
test/lib/_hyperscript.js128 symbols
www/static/js/demo.js16 symbols
www/static/test/util/util.js14 symbols
test/util/util.js14 symbols
www/static/test/core/parameters.js7 symbols
www/static/js/demo/it.js7 symbols
test/core/parameters.js7 symbols

Dependencies from manifests, versioned

@types/node22.18.8 · 1×
@types/parse57.0.0 · 1×
@web/test-runner0.20.2 · 1×
@web/test-runner-playwright0.11.0 · 1×
chai4.5.0 · 1×
chai-dom1.12.1 · 1×
eslint8.57.1 · 1×
eslint-config-standard17.1.0 · 1×
eslint-plugin-import2.29.1 · 1×
eslint-plugin-mocha10.5.0 · 1×
fs-extra9.1.0 · 1×
mocha11.7.4 · 1×

For agents

$ claude mcp add htmx \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact