htmx

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Index

Constants

View Source
const (

	// indicates that the request is via an element using hx-boost
	HxBoosted = "HX-Boosted"

	// the current URL of the browser
	HxCurrentURL = "HX-Current-URL"

	// true if the request is for history restoration after a miss in the local
	// history cache
	HxHistoryRestoreRequest = "HX-History-Restore-Request"

	// the user response to an hx-prompt
	HxPrompt = "HX-Prompt"

	// always true if an htmx request
	HxRequest = "HX-Request"

	// the id of the target element if it exists
	HxTarget = "HX-Target"

	// the name of the triggered element if it exists
	HxTriggerName = "HX-Trigger-Name"

	// the id of the triggered element if it exists
	HxTrigger = "HX-Trigger"

	// allows you to do a client-side redirect that does not do a full page reload
	HxLocation = "HX-Location"

	// pushes a new url into the history stack
	HxPushUrl = "HX-Push-Url"

	// can be used to do a client-side redirect to a new location
	HxRedirect = "HX-Redirect"

	// if set to “true” the client-side will do a full refresh of the page
	HxRefresh = "HX-Refresh"

	// replaces the current URL in the location bar
	HxReplaceUrl = "HX-Replace-Url"

	// allows you to specify how the response will be swapped. See hx-swap for possible values
	HxReswap = "HX-Reswap"

	// a CSS selector that updates the target of the content update to a different element on the page
	HxRetarget = "HX-Retarget"

	// a CSS selector that allows you to choose which part of the response is used to be swapped in. Overrides an existing hx-select on the triggering element
	HxReselect = "HX-Reselect"

	// allows you to trigger client-side events after the settle step
	HxTriggerAfterSettle = "HX-Trigger-After-Settle"

	// allows you to trigger client-side events after the swap step
	HxTriggerAfterSwap = "HX-Trigger-After-Swap"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HxUrlVal

type HxUrlVal url.URL

func (*HxUrlVal) HasPathPrefix

func (hv *HxUrlVal) HasPathPrefix(prefix string) bool

type Hxr

type Hxr struct {
	http.Header
}

func Request

func Request(r *http.Request) *Hxr

func (*Hxr) Boosted

func (hxr *Hxr) Boosted() bool

func (*Hxr) CurrentUrl

func (hxr *Hxr) CurrentUrl() *HxUrlVal

func (*Hxr) HistoryRestoreRequest

func (hxr *Hxr) HistoryRestoreRequest() bool

func (*Hxr) IsRequest

func (hxr *Hxr) IsRequest() bool

func (*Hxr) Prompt

func (hxr *Hxr) Prompt() string

func (*Hxr) Target

func (hxr *Hxr) Target() string

func (*Hxr) Trigger

func (hxr *Hxr) Trigger() string

func (*Hxr) TriggerName

func (hxr *Hxr) TriggerName() string

type Hxw

type Hxw struct {
	http.ResponseWriter
}

func Response

func Response(w http.ResponseWriter) *Hxw

func (*Hxw) HxLocation

func (hxw *Hxw) HxLocation(location string)

func (*Hxw) HxRedirect

func (hxw *Hxw) HxRedirect(target string)

func (*Hxw) HxRefesh

func (hxw *Hxw) HxRefesh()

func (*Hxw) HxTriggerAfterSwap

func (hxw *Hxw) HxTriggerAfterSwap(triggerName string)

Jump to

Keyboard shortcuts

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