+++
title = "Extensions"
+++

htmx supports extensions to augment the core hypermedia infrastructure it provides.  The extension mechanism takes
pressure off the core library to add new features, allowing it to focus on its main purpose of 
[generalizing hypermedia controls](https://dl.acm.org/doi/10.1145/3648188.3675127).

If you are interested in creating an extension for htmx, please see [Building htmx Extensions](/extensions/building).

htmx extensions are split into two categories:

* [core extensions](#core-extensions) - supported by the htmx team
* [community extensions](#community-extensions) - supported by the broader community

## Core Extensions

| Name                                             | Description                                                                                                                                                                                |
|--------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [head-support](/extensions/head-support)         | Provides support for merging head tag information (styles, etc.) in htmx requests                                                                                                          |
| [htmx-1-compat](/extensions/htmx-1-compat)       | Rolls back most of the behavioral changes of htmx 2 to the htmx 1 defaults.                                                                                                                |
| [idiomorph](/extensions/idiomorph)               | Provides a `morph` swap strategy based on the [idiomorph](https://github.com/bigskysoftware/idiomorph/) morphing library, which was created by the htmx team.                              |
| [preload](/extensions/preload)                   | This extension allows you to load HTML fragments into your browser's cache before they are requested by the user, so that additional pages appear to users to load nearly instantaneously. |
| [response-targets](/extensions/response-targets) | This extension allows you to specify different target elements to be swapped when different HTTP response codes are received.                                                              |
| [sse](/extensions/sse)                           | Provides support for [Server Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) directly from HTML.                                |
| [ws](/extensions/ws)                             | Provides bi-directional communication with [Web Sockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications) servers directly from HTML |

## Community Extensions

| Name                                                                                                                     | Description                                                                                                                                                                                                                                                                                   |
|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ajax-header](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/ajax-header/README.md)                     | Adds an `X-Requested-With` header to all requests made by htmx                                                                                                                                                                                                                                |
| [alpine-morph](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/alpine-morph/README.md)                   | Alpine.js now has a lightweight [morph plugin](https://alpinejs.dev/plugins/morph) and this extension allows you to use it as the swapping mechanism in htmx which is necessary to retain Alpine state when you have entire Alpine components swapped by htmx.                                |
| [class-tools](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/class-tools/README.md)                     | The `class-tools` extension allows you to specify CSS classes that will be swapped onto or off of the elements by using a `classes` or `data-classes` attribute.                                                                                                                              |
| [client-side-templates](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/client-side-templates/README.md) | This extension supports transforming a JSON/XML request response into HTML via a client-side template before it is swapped into the DOM.                                                                                                                                                      |
| [debug](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/debug/README.md)                                 | This extension includes log all htmx events for the element it is on, either through the `console.debug` function or through the `console.log` function with a `DEBUG:` prefix.                                                                                                               |
| [disable-element](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/disable-element/README.md)             | This extension disables an element during an htmx request, when configured on the element triggering the request. Note that this functionality is now part of the core of htmx via the `hx-disabled-elt` attribute                                                                            |
| [event-header](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/event-header/README.md)                   | This extension adds the `Triggering-Event` header to requests. The value of the header is a JSON serialized version of the event that triggered the request.                                                                                                                                  |
| [include-vals](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/include-vals/README.md)                   | The `include-vals` extension allows you to programmatically include values in a request with a `include-vals` attribute. The value of this attribute is one or more name/value pairs, which will be evaluated as the fields in a javascript object literal.                                   |
| [json-enc-custom](https://github.com/Emtyloc/json-enc-custom/blob/main/README.md)                                        | This extension works similarly to json-enc but allows for very complex structures, such as embedding JSON objects, lists, or handling indexes, just by using the name attribute.                                                                                                              |
| [json-enc](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/json-enc/README.md)                           | This extension encodes parameters in JSON format instead of url format.                                                                                                                                                                                                                       |
| [loading-states](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/loading-states/README.md)               | This extension allows you to easily manage loading states while a request is in flight, including disabling elements, and adding and removing CSS classes.                                                                                                                                    |
| [morphdom-swap](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/morphdom-swap/README.md)                 | Provides a `morph` swap strategy based on the [morphdom](https://github.com/patrick-steele-idem/morphdom/) morphing library.                                                                                                                                                                  |
| [multi-swap](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/multi-swap/README.md)                       | This extension allows you to swap multiple elements marked from the HTML response. You can also choose for each element which swap method should be used.                                                                                                                                     |
| [no-cache](https://github.com/craigharman/htmx-ext-no-cache/blob/master/README.md)                                       | This extension forces HTMX to bypass client caches and make a new request. An `hx-no-cache` header is also added to allow server-side caching to be bypassed.                                                                                                                                 |
| [path-deps](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/path-deps/README.md)                         | This extension supports expressing inter-element dependencies based on paths, inspired by the [intercooler.js dependencies mechanism](http://intercoolerjs.org/docs.html#dependencies).                                                                                                       |
| [path-params](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/path-params/README.md)                     | This extension uses request parameters to populate path variables. Used parameters are removed so they won't be sent in the query string or body anymore.                                                                                                                                     |
| [remove-me](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/remove-me/README.md)                         | Allows you to remove an element after a specified interval.                                                                                                                                                                                                                                   |
| [replace-params](https://github.com/fanelfaa/htmx-ext-replace-params/blob/main/README.md)                                | This extension uses request parameters to replace existing parameters. If given value is empty string then parameter will be deleted. This extension would be useful in situations like pagination, search that you only want to replace only few parameters instead of reset all parameters. |
| [restored](https://github.com/bigskysoftware/htmx-extensions/blob/main/src/restored/README.md)                           | Triggers an event whenever a back button even is detected while using `hx-boost`                                                                                                                                                                                                              |
| [safe-nonce](https://github.com/MichaelWest22/htmx-extensions/blob/main/src/safe-nonce/README.md)                        | The `safe-nonce` extension can be used to improve the security of the application/web-site and help avoid XSS issues by allowing you to return known trusted inline scripts safely                                                                                                            |
| [signalr](https://github.com/Renerick/htmx-signalr/blob/master/README.md)                                                | Provides bidirectional real-time communication via [SignalR](https://github.com/dotnet/AspNetCore/tree/main/src/SignalR).                                                                                                                                                                     |
| [amz-content-sha256](https://github.com/felipegenef/amz-content-sha256/blob/main/README.md)                              | HTMX extension for interacting with AWS services that require the content hash as part of the request for data integrity verification.                                                                                                                                                        |