htmxinterop

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package htmxinterop is the compiled source for docs/guide/htmx-interop.md.

It shows the two places HTMX may live on a page that also has live regions, and the handler that serves an HTMX swap. Neither path touches the live session: an hx-get is an ordinary GET to an ordinary http.Handler.

templ: version: v0.3.1020

Index

Constants

This section is empty.

Variables

View Source
var Notes = []string{"disk replaced", "certificate renewed"}

Notes is the application data the HTMX island fetches.

Functions

func ControlsRegion

func ControlsRegion(paused bool) templ.Component

ControlsRegion is a live region that hosts an HTMX-owned island.

The rule is innermost-declaration-wins. The <section> is a live region, so morph owns it. live.Preserve marks the <div> and its whole subtree as not the server's, and morph leaves it alone — so HTMX's swap into it survives every patch, and the hx-* element HTMX processed at page load is never replaced by markup HTMX has not seen.

An hx-* element inside a live region WITHOUT live.Preserve is server-owned: morph will overwrite it, and any swap into it will be reverted by the next patch. The library does not detect that; it is a documented precedence rule, not a server-side scan of rendered HTML.

func DeploysRegion

func DeploysRegion() templ.Component

DeploysRegion is plain HTMX OUTSIDE every declared live region.

It is not a fragment, it is not in Config.Fragments, and no patch can name it, so morph never reaches it and live.Preserve is not needed. This is the cheaper of the two arrangements and the one to prefer when the markup does not have to sit inside a live region.

func NotesHandler

func NotesHandler() http.Handler

NotesHandler serves the fragment the island swaps in.

gotth-live neither intercepts nor rewrites this request. It is a plain handler returning HTML over HTTP, which is what "plain HTMX" means, and it is registered on the application's own router beside the live handler.

func NotesList

func NotesList(notes []string, at string) templ.Component

NotesList is what /htmx/notes serves: templ-rendered HTML over ordinary HTTP.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL