Skip to content

Extensions

htmx 4 provides several extensions maintained by their core team. The htmx_ext sub-module provides a Drupal integration for these extensions. Extensions are enabled by enabling the htmx_ext module and browsing to /admin/config/system/htmx-extensions.

Compatibility

Performance

  • hx-preload — Preload on hover with hx-preload='mouseover'
  • hx-ptag — Skip unchanged polls with HX-PTag: "v42"
  • hx-history-cache — Restore back/forward pages from sessionStorage

Security

  • hx-csp — Make htmx work under strict Content Security Policy

Streaming HTML

  • hx-multipart — Stream HTML with multipart/mixed
  • hx-sse — Stream HTML with text/event-stream (SSE)
  • hx-ws — Stream HTML and send data over WebSockets

Swaps

  • hx-head — Merge <head> tags with hx-head='merge'
  • hx-upsert — Update or insert elements with hx-swap='upsert'
  • hx-targets — Target many elements with hx-targets='.selector'
  • hx-download — Download files with hx-swap='download'

UX

  • hx-live — Add reactive bindings to HTML
  • hx-pending — Show custom content during requests - from loading states to optimistic updates
  • hx-browser-indicator — Show tab's spinner with hx-browser-indicator
  • hx-prompt — Prompt before requests with hx-prompt='Reason?'