maragudk / maragudk/gomponents-htmx
htmx 4: new core attributes and hx-partial element
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 124
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
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:` | 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`
`` is a response-side element for multi-target updates. https://four.htmx.org/reference/tags/hx-partial
```go
func Partial(children ...g.Node) g.Node // g.El("hx-partial", children...)
```
Targets and swaps are passed as ordinary `Target`/`Swap` attribute children. The `` 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 `...`.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating existing modifier-based attribute helpers and the Modifier type, then follow their test and godoc Example patterns. Add the seven core helpers and Partial with the documented signatures, keeping extension attributes and typed or map values out of scope; verify the required rendered markup and tests/examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling, web-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100