gomponents-htmx – maragu.dev/gomponents-htmx Index | Examples | Files | Directories

package htmx

import "maragu.dev/gomponents-htmx"

Package htmx provides HTMX attributes and helpers for gomponents. See https://htmx.org/

Index

Examples

Functions

func Boost

func Boost(v string) g.Node

Boost to add or remove progressive enhancement for links and forms. See https://htmx.org/attributes/hx-boost

func Confirm

func Confirm(v string) g.Node

Confirm shows a confirm() dialog before issuing a request. See https://htmx.org/attributes/hx-confirm

func Delete

func Delete(v string) g.Node

Delete will issue a DELETE to the specified URL and swap the HTML into the DOM using a swap strategy. See https://htmx.org/attributes/hx-delete

func Disable

func Disable(v string) g.Node

Disable htmx processing for the given node and any children nodes. See https://htmx.org/attributes/hx-disable

func DisabledElt

func DisabledElt(v string) g.Node

Disable element until htmx request completes. See https://htmx.org/attributes/hx-disabled-elt/

func Disinherit

func Disinherit(v string) g.Node

Disinherit controls and disables automatic attribute inheritance for child nodes. See https://htmx.org/attributes/hx-disinherit

func Encoding

func Encoding(v string) g.Node

Encoding changes the request encoding type. See https://htmx.org/attributes/hx-encoding

func Ext

func Ext(v string) g.Node

Ext sets extensions to use for this element. See https://htmx.org/attributes/hx-ext

func Get

func Get(url string) g.Node

Get from the specified URL. See https://htmx.org/attributes/hx-get

Example

Code:

{
	n := Button(hx.Post("/clicked"), hx.Swap("outerHTML"))
	_ = n.Render(os.Stdout)
	// Output: <button hx-post="/clicked" hx-swap="outerHTML"></button>
}

Output:

<button hx-post="/clicked" hx-swap="outerHTML"></button>

func Headers

func Headers(v string) g.Node

Headers adds to the headers that will be submitted with the request. See https://htmx.org/attributes/hx-headers

func History

func History(v string) g.Node

History prevents sensitive data being saved to the history cache. See https://htmx.org/attributes/hx-history

func HistoryElt

func HistoryElt(v string) g.Node

HistoryElt sets the element to snapshot and restore during history navigation. See https://htmx.org/attributes/hx-history-elt

func Include

func Include(v string) g.Node

Include additional data in requests. See https://htmx.org/attributes/hx-include

func Indicator

func Indicator(v string) g.Node

Indicator sets the element to put the htmx-request class on during the request. See https://htmx.org/attributes/hx-indicator

func On

func On(name string, v string) g.Node

On handles any event with a script inline. See https://htmx.org/attributes/hx-on

func Params

func Params(v string) g.Node

Params filters the parameters that will be submitted with a request. See https://htmx.org/attributes/hx-params

func Patch

func Patch(v string) g.Node

Patch issues a PATCH to the specified URL. See https://htmx.org/attributes/hx-patch

func Post

func Post(url string) g.Node

Post to the specified URL. See https://htmx.org/attributes/hx-post

func Preserve

func Preserve(v string) g.Node

Preserve specifies elements to keep unchanged between requests. See https://htmx.org/attributes/hx-preserve

func Prompt

func Prompt(v string) g.Node

Prompt shows a prompt() before submitting a request. See https://htmx.org/attributes/hx-prompt

func PushURL

func PushURL(v string) g.Node

PushURL into the browser location bar, creating a new history entry. See https://htmx.org/attributes/hx-push-url

func Put

func Put(v string) g.Node

Put issues a PUT to the specified URL. See https://htmx.org/attributes/hx-put

func ReplaceURL

func ReplaceURL(v string) g.Node

ReplaceURL replaces the URL in the browser location bar. See https://htmx.org/attributes/hx-replace-url

func Request

func Request(v string) g.Node

Request configures various aspects of the request. See https://htmx.org/attributes/hx-request

func Select

func Select(v string) g.Node

Select content to swap in from a response. See https://htmx.org/attributes/hx-select

func SelectOOB

func SelectOOB(v string) g.Node

SelectOOB content to swap in from a response, out of band (somewhere other than the target). See https://htmx.org/attributes/hx-select-oob

func Swap

func Swap(v string) g.Node

Swap controls how content is swapped in. See https://htmx.org/attributes/hx-swap

func SwapOOB

func SwapOOB(v string) g.Node

SwapOOB marks content in a response to be out of band (should swap in somewhere other than the target). See https://htmx.org/attributes/hx-swap-oob

func Sync

func Sync(v string) g.Node

Sync controls how requests made by different elements are synchronized. See https://htmx.org/attributes/hx-sync

func Target

func Target(v string) g.Node

Target specifies the target element to be swapped. See https://htmx.org/attributes/hx-target

func Trigger

func Trigger(v string) g.Node

Trigger specifies the event that triggers the request. See https://htmx.org/attributes/hx-trigger

func Validate

func Validate(v string) g.Node

Validate forces elements to validate themselves before a request. See https://htmx.org/attributes/hx-validate

func Vals

func Vals(v string) g.Node

Vals adds values to the parameters to submit with the request (JSON-formatted). See https://htmx.org/attributes/hx-vals

Source Files

htmx.go

Directories

PathSynopsis
cmd
cmd/example
httpPackage http provides helpers for working with HTMX HTTP requests.
internal
Version
v0.6.1 (latest)
Published
Oct 11, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
1 month ago

Tools for package owners.