xe/skills · Archived

templ-htmx

Build interactive hypermedia-driven applications with templ and HTMX. Use when creating dynamic UIs, real-time updates, AJAX interactions, mentions 'HTMX', 'dynamic content', or 'interactive templ app'.

First seen Mar 31, 2026

Installation

$ npx skills add xe/skills --skill templ-htmx

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from xe/skills.

npx skills add xe/skills

Browse all from xe/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 5
License LICENSE
Default branch main
Open issues 0
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,279 B
  • docs SUMMARY.md 220 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 4 installs

SKILL.md

Templ + HTMX Integration

Use progressive disclosure: first make one interaction work, then scale to advanced behaviors.

Level 1: First Working Flow

Use this skill for server-driven interactivity without a JS framework.

  1. Mount HTMX assets in server setup.
  2. Include HTMX script in the layout.
  3. Add hx-* attributes to a component.
  4. Return a partial component from the handler.
  5. Branch full-page vs fragment responses with HTMX request detection.
import "within.website/x/web/htmx"

func main() {
    mux := http.NewServeMux()
    htmx.Mount(mux)
}
import "within.website/x/web/htmx"

templ Layout() {
    <html>
        <head>@htmx.Use()</head>
        <body>{ children... }</body>
    </html>
}

Level 2: Core HTMX Controls

  • hx-get / hx-post: trigger requests.
  • hx-target: pick where response lands.
  • hx-swap: choose replacement strategy (innerHTML, outerHTML, beforeend).
  • hx-trigger: control event timing (click, change, every 5s, etc).
  • hx-indicator: show loading state.

Level 3: Advanced Server Patterns

  • Detect HTMX requests with htmx.Is(r) and return fragments.
  • Use out-of-band updates for multi-region refreshes.
  • Use response headers (HX-Trigger, HX-Redirect) for client behavior.
  • Preserve progressive enhancement: endpoints should still work without JS.
func profileHandler(w http.ResponseWriter, r *http.Request) {
    if htmx.Is(r) {
        _ = components.ProfilePanel().Render(r.Context(), w)
        return
    }
    _ = components.ProfilePage().Render(r.Context(), w)
}

Escalate to Other Skills

  • Need handler/routing structure: use templ-http.
  • Need reusable component APIs: use templ-components.
  • Need template syntax help: use templ-syntax.

References