Part of #18. Depends on the Modifier type from the modifiers sub-issue. Core attributes only; extension attributes are out of scope by decision. Reference: https://four.htmx.org/reference/attributes
New attribute helpers
| Helper |
Attribute |
Notes |
Action(url) |
hx-action |
URL for the request, mirroring native action. |
Method(v) |
hx-method |
get, post, put, patch, delete, query. |
Query(url) |
hx-query |
Issues an HTTP QUERY request. |
Config(v) |
hx-config |
HCON or JSON string. Replaces hx-request. |
Status(code, v) |
hx-status:<code> |
Key-form attribute like On. code is a string so 50x/5xx wildcards work. |
MorphSkip() |
hx-morph-skip |
Bare attribute. |
MorphSkipChildren() |
hx-morph-skip-children |
Bare attribute. |
All take ...Modifier. Values stay plain strings; typed/map forms for JSON-valued attributes are a possible follow-up, not part of this.
New element: hx-partial
<hx-partial hx-target="..." hx-swap="..."> is a response-side element for multi-target updates. https://four.htmx.org/reference/tags/hx-partial
func Partial(children ...g.Node) g.Node // g.El("hx-partial", children...)
Targets and swaps are passed as ordinary Target/Swap attribute children. The <template hx type="partial"> variant is not needed since gomponents does not strip unknown tags.
Acceptance criteria
- Each helper above exists with a verbatim doc comment linking to the reference page, a test, and a godoc
Example.
Partial renders <hx-partial hx-target="#x" hx-swap="outerHTML">...</hx-partial>.
Part of #18. Depends on the
Modifiertype from the modifiers sub-issue. Core attributes only; extension attributes are out of scope by decision. Reference: https://four.htmx.org/reference/attributesNew attribute helpers
Action(url)hx-actionaction.Method(v)hx-methodget,post,put,patch,delete,query.Query(url)hx-queryQUERYrequest.Config(v)hx-confighx-request.Status(code, v)hx-status:<code>On.codeis a string so50x/5xxwildcards work.MorphSkip()hx-morph-skipMorphSkipChildren()hx-morph-skip-childrenAll take
...Modifier. Values stay plain strings; typed/map forms for JSON-valued attributes are a possible follow-up, not part of this.New element:
hx-partial<hx-partial hx-target="..." hx-swap="...">is a response-side element for multi-target updates. https://four.htmx.org/reference/tags/hx-partialTargets and swaps are passed as ordinary
Target/Swapattribute children. The<template hx type="partial">variant is not needed since gomponents does not strip unknown tags.Acceptance criteria
Example.Partialrenders<hx-partial hx-target="#x" hx-swap="outerHTML">...</hx-partial>.