Complete reference for all html★ data attributes.

Request Attributes

AttributeValuesDescription
data-hrefURLExplicit URL (overrides href/action)
data-methodget, post, put, patch, deleteHTTP method
data-headersJSON objectAdditional request headers
data-includeCSS selector, "self"Include inputs in request

Response Attributes

AttributeValuesInheritsDescription
data-targetCSS selector, "self"Where to swap content
data-swapinner, outer, prepend, append, before, after, delete, noneSwap strategy
data-selectCSS selectorExtract fragment from response
data-oob(boolean)Process out-of-band swaps

Behavior Attributes

AttributeValuesInheritsDescription
data-triggerclick, submit, change, input, visible, loadEvent trigger
data-push(boolean)Push to browser history
data-replace(boolean)Replace history entry
data-confirmmessage stringShow confirmation dialog
data-disable(boolean)Disable during request
data-transitionstrue, falseEnable View Transitions
data-debouncemillisecondsDebounce delay for input trigger
data-instant(boolean)Navigate on mousedown instead of click
data-send-headers(boolean)Send target/select selectors as request headers
data-prefetchhover, hover:<ms>, visible, eager, falsePrefetch strategy

Persistence Attributes

AttributeValuesInheritsDescription
data-persiststorage keyPersist input value
data-persist-scopelocal, sessionStorage type

Streaming Attributes

AttributeValuesInheritsDescription
data-sseURLSSE endpoint
data-sse-eventscomma-separated namesNamed events to listen for
data-pollinterval (e.g., "5s")Polling interval

Caching Attributes

AttributeValuesInheritsDescription
data-cacheduration (30s, 5m, 1h, 1d), swr, swr:<duration>Cache GET responses
data-cache-storagememory, sessionCache storage backend (default: memory)
data-cache-invalidatecomma-separated URL patternsInvalidate cache entries on non-GET success

Error & Loading Attributes

AttributeValuesInheritsDescription
data-error-targetCSS selectorElement to show on request error
data-loading-targetCSS selectorElement to show during request
data-loading-classCSS class nameClass added to trigger + target during request
data-queuefirst, last, allConcurrent request behavior (default: last)
data-retry(boolean)Retry button inside error target

State Attributes (Set by html★)

These are set by html★ for CSS targeting:

AttributeWhen SetOn Element
[data-loading]Request in progressTrigger element
[data-swapping]Swap in progressTarget element
[data-success]Swap completed (2s)Target element
[data-error]Request failedTrigger element
[data-error-message]Error messageTrigger element
[data-sse-connected]SSE connectedSSE element
[data-sse-error]SSE errorSSE element

Meta Tag Configuration

Set defaults via meta tags:

JSON Configuration

For more advanced configuration, use a JSON script block. JSON config takes precedence over meta tags:

defaults apply globally (like meta tags, but in one place).

selectors apply to elements matching CSS selectors. When an element matches multiple selectors, all matching rules are checked. Selector-based rules take precedence over defaults.