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
htmx-2-compat— Restore htmx 2.x defaults and event names on htmx 4hx-alpine-compat— Run htmx alongside Alpine.js without conflicts
Performance
hx-preload— Preload on hover withhx-preload='mouseover'hx-ptag— Skip unchanged polls withHX-PTag: "v42"hx-history-cache— Restore back/forward pages fromsessionStorage
Security
hx-csp— Make htmx work under strict Content Security Policy
Streaming HTML
hx-multipart— Stream HTML withmultipart/mixedhx-sse— Stream HTML withtext/event-stream(SSE)hx-ws— Stream HTML and send data over WebSockets
Swaps
hx-head— Merge<head>tags withhx-head='merge'hx-upsert— Update or insert elements withhx-swap='upsert'hx-targets— Target many elements withhx-targets='.selector'hx-download— Download files withhx-swap='download'
UX
hx-live— Add reactive bindings to HTMLhx-pending— Show custom content during requests - from loading states to optimistic updateshx-browser-indicator— Show tab's spinner withhx-browser-indicatorhx-prompt— Prompt before requests withhx-prompt='Reason?'