Htmx : Htmx is a JavaScript library for performing AJAX requests, triggering CSS transitions, and invoking WebSocket and server-sent events directly from HTML elements.
This technology is used by 0% of websites in the JavaScript libraries category. The most popular industry vertical is Business and Finance, with Travel Type being the top subcategory.
What is HTMX?
HTMX is a JavaScript library that allows you to access modern browser features directly from HTML, using attributes rather than writing JavaScript. It enables AJAX requests, CSS transitions, WebSockets, and Server-Sent Events through declarative HTML attributes.
HTMX is the successor to intercooler.js, created by Carson Gross. Released in 2020, it represents a return to the original vision of hypermedia—extending HTML to handle dynamic interactions that previously required complex JavaScript frameworks. HTMX promotes HATEOAS (Hypermedia as the Engine of Application State) principles, returning HTML fragments from servers instead of JSON data for JavaScript to render.
Industry Vertical Distribution
Technologies Frequently Used with Htmx
| Technology | Co-usage Rate | Website |
|---|---|---|
| Unpkg | 78.08% | https://unpkg.com |
| Open Graph | 73.97% | https://ogp.me |
| PHP | 60.27% | http://php.net |
| Google Analytics | 35.62% | http://google.com/analytics |
| PWA | 34.25% | https://web.dev/progressive-web-apps/ |
| core-js | 34.25% | https://github.com/zloirock/core-js |
| Google Tag Manager | 34.25% | http://www.google.com/tagmanager |
| jQuery | 27.4% | https://jquery.com |
| HSTS | 24.66% | https://www.rfc-editor.org/rfc/rfc6797#section-6.1 |
| Craft CMS | 21.92% | https://craftcms.com |
Key Features
Core Attributes
- hx-get/post/put/delete: Make HTTP requests
- hx-target: Where to place response
- hx-swap: How to swap content
- hx-trigger: What triggers the request
- hx-indicator: Loading indicator element
Swap Methods
- innerHTML: Replace target's content
- outerHTML: Replace entire target
- beforebegin: Insert before target
- afterend: Insert after target
- delete: Remove target
Triggers
- click: On element click
- change: On form element change
- submit: On form submission
- load: On element load
- revealed: When scrolled into view
- every Ns: Polling intervals
Extensions
- WebSocket connections
- Server-Sent Events
- Loading states
- Morphdom integration
AI-Powered Technology Recommendations
Our AI recommender engine, trained on 100 million data points, suggests these technologies for websites using Htmx:
| Technology | AI Score | Website |
|---|---|---|
| Craft CMS | 0.35 | https://craftcms.com |
| Yii | 0.35 | https://www.yiiframework.com |
| Unpkg | 0.33 | https://unpkg.com |
| SEOmatic | 0.29 | https://plugins.craftcms.com/seomatic |
| Marketo | 0.2 | https://www.marketo.com |
| Highcharts | 0.2 | https://www.highcharts.com |
| Blitz | 0.19 | https://putyourlightson.com/plugins/blitz |
| Plausible | 0.19 | https://plausible.io/ |
| Snap.svg | 0.18 | http://snapsvg.io |
| Sucuri | 0.17 | https://sucuri.net/ |
IAB Tier 1 Vertical Distribution
Relative Usage by Industry
Market Distribution Comparison
Use Cases
Progressive Enhancement
Server-rendered applications add interactivity without rewriting as SPAs. Forms submit via AJAX, updating only relevant page sections while maintaining server-side rendering benefits.
Dashboard Updates
Admin dashboards refresh data without full page reloads. Polling attributes fetch updated statistics, while triggered requests reload specific panels.
Infinite Scroll
Content feeds load more items as users scroll. The revealed trigger detects when placeholders enter viewport, fetching and appending new content.
Form Validation
Forms validate fields server-side as users type. Debounced triggers send partial form data, returning validation messages that update inline.
Search Interfaces
Search results update as users type queries. Server-rendered result lists replace existing content, maintaining SEO-friendly HTML output.
Multi-Step Wizards
Multi-step forms navigate without page reloads. Each step submits data and receives the next step's HTML, with history integration for back button support.
IAB Tier 2 Subcategory Distribution
Top Websites Using Htmx
| Website | IAB Category | Subcategory | OpenRank |
|---|---|---|---|
| tefaf.com | Fine Art | Fine Art Photography | 4.37 |
| originalbotanica.com | Religion & Spirituality | Spirituality | 4.29 |
| omniatlas.com | Business and Finance | Continent | 4.28 |
| grand-challenge.org | Technology & Computing | Artificial Intelligence | 4.26 |
| rorc.org | Sports | Sailing | 4.19 |
| rewindfestival.com | Events and Attractions | Fashion Events | 4.19 |
| sbimaterials.com | Home & Garden | Landscaping | 4.18 |
| formech.com | Business and Finance | Industries | 4.18 |
| bmm.org | Music and Audio | Gospel Music | 4.16 |
| mtnskyumc.org | Music and Audio | Gospel Music | 4.14 |
Code Examples
Basic AJAX Request
<!-- Click to load content -->
<button hx-get="/api/users"
hx-target="#user-list"
hx-swap="innerHTML">
Load Users
</button>
<div id="user-list"></div>
Form Submission
<form hx-post="/contacts"
hx-target="#contact-form"
hx-swap="outerHTML">
<input type="text" name="name" required>
<input type="email" name="email" required>
<button type="submit">Add Contact</button>
<span class="htmx-indicator">Saving...</span>
</form>
Infinite Scroll
<div id="posts">
<!-- Initial posts -->
<div class="post">Post 1</div>
<div class="post">Post 2</div>
<!-- Trigger when visible -->
<div hx-get="/posts?page=2"
hx-trigger="revealed"
hx-swap="afterend">
Loading more...
</div>
</div>
Live Search
<input type="search"
name="q"
hx-get="/search"
hx-trigger="keyup changed delay:500ms"
hx-target="#results">
<div id="results"></div>
Delete with Confirmation
<button hx-delete="/items/123"
hx-confirm="Are you sure?"
hx-target="closest tr"
hx-swap="outerHTML swap:1s">
Delete
</button>
Server Response (PHP)
// Return HTML fragment, not JSON
echo '<tr>
<td>' . htmlspecialchars($name) . '</td>
<td>' . htmlspecialchars($email) . '</td>
</tr>';
Usage by Domain Popularity (Top 1M)
Usage by Domain Age
The average age of websites using Htmx is 14.5 years. The average OpenRank (measure of backlink strength) is 2.92.
Philosophy and Comparison
Hypermedia Philosophy
- Server-Rendered HTML: Server returns HTML, not JSON
- HATEOAS: Application state in hypermedia
- Progressive Enhancement: Works without JavaScript
- Simplicity: Reduce client-side complexity
HTMX vs React/Vue
- Rendering: HTMX server-side, React client-side
- State: HTMX in server, React in client
- Size: HTMX ~14KB, React ~40KB+
- Complexity: HTMX simpler, React more powerful
Works Well With
- Django: django-htmx package
- Flask: Native HTML responses
- Laravel: Blade partial rendering
- Rails: Turbo complement
- Alpine.js: Client-side interactions
Best For
- Teams preferring server-side rendering
- Adding interactivity to existing apps
- Simpler applications without SPA needs
- Reducing JavaScript complexity
Consider Alternatives When
- Building offline-capable applications
- Complex client-side state management
- Heavy client-side data transformation
- Team expertise in React/Vue ecosystem
Emerging Websites Using Htmx
| Website | IAB Category | Subcategory | OpenRank |
|---|---|---|---|
| syncorate.com | Personal Finance | Insurance | 0 |
| orangewip.com | Business and Finance | Business | 0 |
| drive4southernag.com | Personal Finance | Business | 1.4 |
| drive4unigroup.com | Business and Finance | Industries | 1.49 |
| profsmallpine.com | Hobbies & Interests | Industries | 1.67 |
Technologies Less Frequently Used with Htmx
| Technology | Co-usage Rate | Website |
|---|---|---|
| Microsoft Clarity | 1.37% | https://clarity.microsoft.com |
| Stimulus | 1.37% | https://stimulusjs.org/ |
| Osano | 1.37% | https://www.osano.com/ |
| ActiveCampaign | 1.37% | https://www.activecampaign.com |
| AdRoll CMP System | 1.37% | https://www.adroll.com/features/consent-management |
