Extensions, Hyperscript & Debug
Htmx bundles HTMX 4, 16 official HTMX 4 extensions, and Hyperscript locally inside site/modules/Htmx/ so your site never relies on third-party CDNs.
All 16 Bundled HTMX 4 Extensions
Section titled “All 16 Bundled HTMX 4 Extensions”Enable extensions globally via the extensions module config setting (Modules -> Configure -> Htmx), or load them per-template with $htmx->loadExtension('hx-preload') (or $htmx->use(['hx-preload', 'hx-head'])):
| Extension | Purpose |
|---|---|
hx-ws |
WebSocket bidirectional swaps and message triggers |
hx-sse |
Server-Sent Events (SSE) live streaming fragments |
hx-head |
Merges <head> tags (title, meta, styles) during boosted/partial swaps |
hx-preload |
Preloads target URLs on mousedown or hover for instant navigation |
hx-targets |
Routes non-2xx HTTP responses (e.g., 422, 404) to dedicated error targets |
hx-prompt |
Enhanced confirmation and prompt dialogs before firing requests |
hx-csp |
Strict Content Security Policy compatibility helpers |
hx-alpine-compat |
Seamless state preservation alongside Alpine.js components |
hx-multipart |
Multipart and mixed-response partial handling |
hx-history-cache |
Fine-grained control over HTMX history snapshot caching |
hx-live |
Live reactive element updates and synchronization |
hx-browser-indicator |
Native browser loading indicator integration |
hx-download |
Triggers file downloads cleanly from HTMX responses |
hx-pending |
Tracks pending async swap states and classes |
hx-ptag |
Partial tag helpers for structured fragment updates |
hx-upsert |
Upserts keyed list items in place without re-rendering full lists |
Loading Extensions & Hyperscript Per Template
Section titled “Loading Extensions & Hyperscript Per Template”$htmx = $this->wire()->htmx;
// Load individual extensions only on templates that need them$htmx->loadExtension('hx-preload');$htmx->loadExtension('hx-head');
// Or load multiple at once$htmx->use(['hx-targets', 'hx-sse']);
// Enable bundled Hyperscript on demand$htmx->loadHyperscript();Debugging with HtmxTracyPanel
Section titled “Debugging with HtmxTracyPanel”When tracySupport is enabled (default true) and TracyDebugger is active in debug mode:
HtmxTracyPanelautomatically registers a dedicated HTMX panel in the Tracy bar.- Every HTMX response emits diagnostic
X-PW-HTMX-*headers showing the matched component, executed action, cache hit/miss status, and render timing. - Call
$htmx->getAssetConfigToken()to inspect the active asset version token injected into script URLs for cache busting.