Claude Code Plugins

Community-maintained marketplace

Feedback
0
0

Documentation for the htmx JavaScript library (attributes, events, headers, API, extensions, examples, migration guides, server examples). Use when you need accurate htmx syntax/behavior or to locate the right reference page for an htmx question.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name htmx-skill
description Documentation for the htmx JavaScript library (attributes, events, headers, API, extensions, examples, migration guides, server examples). Use when you need accurate htmx syntax/behavior or to locate the right reference page for an htmx question.

htmx Reference

Use the index below to open the most specific page for the user's question. Search the local references/ folder with rg when unsure which page contains the answer.

Reference Index

General

  • Events: Documentation page

  • Javascript API: This documentation describes the JavaScript API for htmx, including methods and properties for configuring the behavior of htmx, working with CSS classes, AJAX requests, event handling, and DOM manipulation. The API provides helper functions primarily intended for extension development and event management.

Attributes

  • hx-boost: The hx-boost attribute in htmx enables progressive enhancement by converting standard HTML anchors and forms into AJAX requests, maintaining graceful fallback for users without JavaScript while providing modern dynamic page updates for those with JavaScript enabled.

  • hx-confirm: The hx-confirm attribute in htmx provides a way to add confirmation dialogs before executing requests, allowing you to protect users from accidental destructive actions. This documentation explains how to implement confirmation prompts and customize their behavior through event handling.

  • hx-delete: The hx-delete attribute in htmx will cause an element to issue a DELETE request to the specified URL and swap the returned HTML into the DOM using a swap strategy.

  • hx-disable: The hx-disable attribute in htmx will disable htmx processing for a given element and all its children.

  • hx-disabled-elt: The hx-disabled-elt attribute in htmx allows you to specify elements that will have the disabled attribute added to them for the duration of the request.

  • hx-disinherit: The hx-disinherit attribute in htmx lets you control how child elements inherit attributes from their parents. This documentation explains how to selectively disable inheritance of specific htmx attributes or all attributes, allowing for more granular control over your web application's behavior.

  • hx-encoding: The hx-encoding attribute in htmx allows you to switch the request encoding from the usual application/x-www-form-urlencoded encoding to multipart/form-data, usually to support file uploads in an AJAX request.

  • hx-ext: The hx-ext attribute in htmx enables one or more htmx extensions for an element and all its children. You can also use this attribute to ignore an extension that is enabled by a parent element.

  • hx-get: The hx-get attribute in htmx will cause an element to issue a GET request to the specified URL and swap the returned HTML into the DOM using a swap strategy.

  • hx-headers: The hx-headers attribute in htmx allows you to add to the headers that will be submitted with an AJAX request.

  • hx-history: The hx-history attribute in htmx allows you to prevent sensitive page data from being stored in the browser's localStorage cache during history navigation, ensuring that the page state is retrieved from the server instead when navigating through history.

  • hx-history-elt: The hx-history-elt attribute in htmx allows you to specify the element that will be used to snapshot and restore page state during navigation. In most cases we do not recommend using this element.

  • hx-include: The hx-include attribute in htmx allows you to include additional element values in an AJAX request.

  • hx-indicator: The hx-indicator attribute in htmx allows you to specify the element that will have the htmx-request class added to it for the duration of the request. This can be used to show spinners or progress indicators while the request is in flight.

  • hx-inherit: The hx-inherit attribute in htmx allows you to explicitly control attribute inheritance behavior between parent and child elements, providing fine-grained control over which htmx attributes are inherited when the default inheritance system is disabled through configuration.

  • hx-on: The hx-on attributes in htmx allow you to write inline JavaScript event handlers directly on HTML elements, supporting both standard DOM events and htmx-specific events with improved locality of behavior.

  • hx-params: The hx-params attribute in htmx allows you to filter the parameters that will be submitted with an AJAX request.

  • hx-patch: The hx-patch attribute in htmx will cause an element to issue a PATCH request to the specified URL and swap the returned HTML into the DOM using a swap strategy.

  • hx-post: The hx-post attribute in htmx will cause an element to issue a POST request to the specified URL and swap the returned HTML into the DOM using a swap strategy.

  • hx-preserve: The hx-preserve attribute in htmx allows you to keep an element unchanged during HTML replacement. Elements with hx-preserve set are preserved by id when htmx updates any ancestor element.

  • hx-prompt: The hx-prompt attribute in htmx allows you to show a prompt before issuing a request. The value of the prompt will be included in the request in the HX-Prompt header.

  • hx-push-url: The hx-push-url attribute in htmx allows you to push a URL into the browser location history. This creates a new history entry, allowing navigation with the browser's back and forward buttons.

  • hx-put: The hx-put attribute in htmx will cause an element to issue a PUT request to the specified URL and swap the returned HTML into the DOM using a swap strategy.

  • hx-replace-url: The hx-replace-url attribute in htmx allows you to replace the current URL of the browser location history.

  • hx-request: The hx-request attribute in htmx allows you to configure the request timeout, whether the request will send credentials, and whether the request will include headers.

  • hx-select: The hx-select attribute in htmx allows you to select the content you want swapped from a response.

  • hx-select-oob: The hx-select-oob attribute in htmx allows you to select content from a response to be swapped in via an out-of-band swap. The value of this attribute is comma separated list of elements to be swapped out of band.

  • hx-swap: The hx-swap attribute in htmx allows you to specify the 'swap strategy', or how the response will be swapped in relative to the target of an AJAX request. The default swap strategy is innerHTML.

  • hx-swap-oob: The hx-swap-oob attribute in htmx allows you to specify that some content in a response should be swapped into the DOM somewhere other than the target, that is 'out-of-band'. This allows you to piggyback updates to other elements on a response.

  • hx-sync: The hx-sync attribute in htmx allows you to synchronize AJAX requests between multiple elements.

  • hx-target: The hx-target attribute in htmx allows you to target a different element for swapping than the one issuing the AJAX request.

  • hx-trigger: The hx-trigger attribute in htmx allows you to specify what triggers an AJAX request. Supported triggers include standard DOM events, custom events, polling intervals, and event modifiers. The hx-trigger attribute also allows specifying event filtering, timing controls, event bubbling, and multiple trigger definitions for fine-grained control over when and how requests are initiated.

  • hx-validate: The hx-validate attribute in htmx will cause an element to validate itself using the HTML5 Validation API before it submits a request.

  • hx-vals: The hx-vals attribute in htmx allows you to add to the parameters that will be submitted with an AJAX request.

  • hx-vars: The hx-vars attribute in htmx allows you to dynamically add to the parameters that will be submitted with an AJAX request. This attribute has been deprecated. We recommend you use the hx-vals attribute that provides the same functionality with safer defaults.

Examples

Extensions

Headers

  • HX-Location Response Header: Use the HX-Location response header in htmx to trigger a client-side redirection without reloading the whole page.

  • HX-Push Response Header (Deprecated): The HX-Push response header in htmx is deprecated. Use HX-Push-Url instead.

  • HX-Push-Url Response Header: Use the HX-Push-Url response header in htmx to push a URL into the browser location history.

  • HX-Redirect Response Header: Use the HX-Redirect response header in htmx to trigger a client-side redirection that will perform a full page reload.

  • HX-Replace-Url Response Header: Use the HX-Replace-Url response header in htmx to replace the current URL in the browser location history without creating a new history entry.

  • HX-Trigger Response Headers: Use the HX-Trigger family of response headers in htmx to trigger client-side actions from an htmx response.

Usage Notes

  • Prefer attribute/event/header-specific pages over general guides.
  • For API or configuration questions, check api.md in addition to specific pages.
  • Open the referenced file to confirm details before answering if the description seems too brief.