Attributes

Declarative controls for requests, swapping, and targeting.

Requests

  • hx-get - issues GET request to specified URL
  • hx-post - issues POST request to specified URL
  • hx-put - issues PUT request to specified URL
  • hx-patch - issues PATCH request to specified URL
  • hx-delete - issues DELETE request to specified URL
  • hx-query - issues QUERY request to specified URL

Request Control

  • hx-trigger - controls when element issues requests
  • hx-swap - controls how response is inserted
  • hx-target - controls where response is inserted
  • hx-select - controls which response part is inserted
  • hx-swap-oob - marks response elements to swap into page by ID
  • hx-select-oob - picks response elements to swap into page by ID
  • hx-confirm - shows confirmation dialog before request

Scripting

  • hx-on - runs inline JavaScript when event fires

Data

History

Enhancements

  • hx-boost - converts links and forms to AJAX
  • hx-preload - preloads content before user triggers request
  • hx-pending - shows custom content during requests

Advanced

Headers

Request and response headers for server communication.

Request

Response

Events

Lifecycle hooks for requests, responses, swaps, and errors.

Request Lifecycle

Elements

History Events

View Transitions

Triggers

  • intersect - fires when element enters viewport
  • every - fires at each polling interval

Config

Settings to customize htmx behavior and defaults.

Core

Request Settings

Swaps

Morphing

Indicators

Behavior

Methods

JavaScript methods for advanced control.

Request Methods

DOM

Event Handling

Extensions

Timing

Tags

HTML tags provided by htmx.
  • <hx-partial> - targets multiple elements with one response