Sure! Here's a Markdown cheatsheet for the key concepts and capabilities of htmx: ```markdown # htmx Cheatsheet ## Getting Started Include htmx in your HTML: ```html ``` ## Basic Attributes ### `hx-get` Performs a GET request and swaps the response into the target element. ```html
``` ### `hx-post` Performs a POST request. ```html
``` ### `hx-push-url` Updates the browser's URL bar using the History API. ```html ``` ## Content Swapping ### `hx-target` Specifies the target element to update with the response. ```html
Click me
``` ### `hx-swap` Defines how the response content is swapped into the target element. - `innerHTML` (default) - `outerHTML` - `beforebegin` - `afterbegin` - `beforeend` - `afterend` - `delete` ```html
Replace me
``` ## Event Handling ### `hx-trigger` Specifies the event that triggers the request. ```html ``` ### `hx-on` Binds an event handler directly in the HTML. ```html
Hover over me
``` ## Additional Attributes ### `hx-include` Includes additional elements' values in the request. ```html
``` ### `hx-vals` Includes additional parameters in the request. ```html ``` ### `hx-headers` Adds custom headers to the request. ```html ``` ## WebSockets and Server-Sent Events ### `hx-sse` Handles Server-Sent Events. ```html

Waiting for updates...

``` ### `hx-ws` Handles WebSocket connections. ```html

Real-time data will appear here.

``` ## Example Usage ### Simple GET Request ```html
``` ### Form Submission ```html
``` ### Dynamic Content Swap ```html
Load Content
``` ### Real-time Updates with SSE ```html

Waiting for updates...

``` For more detailed information, visit the [htmx documentation](https://htmx.org/docs/). ``` This cheatsheet covers the basic attributes and features of htmx, providing a quick reference for common tasks and use cases.