Documentation
¶
Overview ¶
Package htmx provides a set of functions for generating HTML attributes as nodes. These attributes can be used in conjunction with the Fiber framework and the htmx library.
Index ¶
- Constants
- Variables
- func JSONSerializeOrEmpty(data any) string
- type ClassNames
- type ErrBoundaryFunc
- type Errors
- type FallbackFunc
- type HTML5Props
- type HXSwapStyle
- type HxAttribute
- type HxClassName
- type HxEventType
- type HxExtType
- type HxSwapDirection
- type HxSwapScrolling
- type HxSwapScrollingMode
- type HxSwapTiming
- type HxSwapTimingMode
- type ImportMap
- type ImportsProp
- type JSEventType
- type Node
- func A(children ...Node) Node
- func Abbr(children ...Node) Node
- func Accept(v string) Node
- func Action(v string) Node
- func Address(children ...Node) Node
- func Alt(v string) Node
- func Area(children ...Node) Node
- func Aria(name, v string) Node
- func Article(children ...Node) Node
- func As(v string) Node
- func Aside(children ...Node) Node
- func Async() Node
- func Attribute(name string, value ...string) Node
- func Audio(children ...Node) Node
- func AutoComplete(v string) Node
- func AutoFocus() Node
- func AutoPlay() Node
- func B(children ...Node) Node
- func Base(children ...Node) Node
- func BlockQuote(children ...Node) Node
- func Body(children ...Node) Node
- func Br(children ...Node) Node
- func Button(children ...Node) Node
- func Canvas(children ...Node) Node
- func Caption(children ...Node) Node
- func Charset(v string) Node
- func Checked() Node
- func Cite(children ...Node) Node
- func Class(v string) Node
- func ClipRule(v string) Node
- func Code(children ...Node) Node
- func Col(children ...Node) Node
- func ColGroup(children ...Node) Node
- func ColSpan(v string) Node
- func Cols(v string) Node
- func Comment(comment string) Node
- func Content(v string) Node
- func ContentEditable(v string) Node
- func Controls() Node
- func CrossOrigin(v string) Node
- func CustomElement(tag string, children ...Node) Node
- func D(v string) Node
- func DElement(children ...Node) Node
- func DataAttribute(name, v string) Node
- func DataElement(children ...Node) Node
- func DataList(children ...Node) Node
- func Dd(children ...Node) Node
- func Defer() Node
- func Details(children ...Node) Node
- func Dfn(children ...Node) Node
- func Dialog(children ...Node) Node
- func Disabled() Node
- func Div(children ...Node) Node
- func Dl(children ...Node) Node
- func Doctype(sibling Node) Node
- func Dt(children ...Node) Node
- func Em(children ...Node) Node
- func Embed(children ...Node) Node
- func Empty() Node
- func EncType(v string) Node
- func ErrorBoundary(n ErrBoundaryFunc) Node
- func ErrorExists[K comparable](e Errors[K], key K, fn func(k K, v error) Node) Node
- func Fallback(n Node, f FallbackFunc) Node
- func FieldSet(children ...Node) Node
- func FigCaption(children ...Node) Node
- func Figure(children ...Node) Node
- func Fill(v string) Node
- func FillRule(v string) Node
- func Filter(f func(n Node) bool, children ...Node) []Node
- func Footer(children ...Node) Node
- func For(v string) Node
- func Form(children ...Node) Node
- func FormAttribute(v string) Node
- func FormElement(children ...Node) Node
- func Fragment(children ...Node) Node
- func G(children ...Node) Node
- func Group(children ...Node) Node
- func H1(children ...Node) Node
- func H2(children ...Node) Node
- func H3(children ...Node) Node
- func H4(children ...Node) Node
- func H5(children ...Node) Node
- func H6(children ...Node) Node
- func HGroup(children ...Node) Node
- func HTML(children ...Node) Node
- func HTML5(props HTML5Props, body ...Node) Node
- func HandlebarsTemplate(v string) Node
- func Head(children ...Node) Node
- func Header(children ...Node) Node
- func Height(v string) Node
- func Hr(children ...Node) Node
- func Href(v string) Node
- func HxBoost(v bool) Node
- func HxConfirm(msg string) Node
- func HxDelete(url string) Node
- func HxDisable() Node
- func HxDisabledElt(target string) Node
- func HxEncoding(enc string) Node
- func HxExt(ext string) Node
- func HxGet(url string) Node
- func HxHeaders(headers map[string]string) Node
- func HxInclude(target string) Node
- func HxIndicator(target string) Node
- func HxOn(target string, js string) Node
- func HxPatch(url string) Node
- func HxPost(url string) Node
- func HxPrompt(msg string) Node
- func HxPushURL(v bool) Node
- func HxPut(url string) Node
- func HxSSE() Node
- func HxSSEConnect(url string) Node
- func HxSSESwap(target string) Node
- func HxSelect(target string) Node
- func HxSelectOob(target string) Node
- func HxSwap(target string) Node
- func HxSwapOob(target string) Node
- func HxTarget(target string) Node
- func HxTarget4xx(target string) Node
- func HxTarget5xx(target string) Node
- func HxTarget50x(target string) Node
- func HxTarget401(target string) Node
- func HxTarget403(target string) Node
- func HxTarget404(target string) Node
- func HxTarget500(target string) Node
- func HxTargetError(target string) Node
- func HxTrigger(targets ...string) Node
- func HxValidate(v bool) Node
- func HyperScript(v string) Node
- func I(children ...Node) Node
- func ID(v string) Node
- func IFrame(children ...Node) Node
- func If(condition bool, n Node) Node
- func IfElse(condition bool, n, elseN Node) Node
- func Img(children ...Node) Node
- func Imports(props ImportsProp) Node
- func Input(children ...Node) Node
- func Ins(children ...Node) Node
- func Integrity(v string) Node
- func Is(v string) Node
- func JSEvent(e JSEventType, value ...string) Node
- func Kbd(children ...Node) Node
- func KeyExists[K comparable, V any](m map[K]V, key K, fn func(k K, v V) Node) Node
- func Label(children ...Node) Node
- func Lang(v string) Node
- func Legend(children ...Node) Node
- func Li(children ...Node) Node
- func Link(children ...Node) Node
- func List(v string) Node
- func Loading(v string) Node
- func Loop() Node
- func Main(children ...Node) Node
- func Mark(children ...Node) Node
- func Markdown(source []byte, opts ...goldmark.Option) Node
- func Max(v string) Node
- func MaxLength(v string) Node
- func Meta(children ...Node) Node
- func Meter(children ...Node) Node
- func Method(v string) Node
- func Min(v string) Node
- func MinLength(v string) Node
- func Multiple() Node
- func MustacheTemplate(v string) Node
- func Muted() Node
- func Name(v string) Node
- func Nav(children ...Node) Node
- func NoScript(children ...Node) Node
- func NoValidate() Node
- func NunjucksTemplate(v string) Node
- func Object(children ...Node) Node
- func Ol(children ...Node) Node
- func OnClick(v string) Node
- func OnePasswordIgnore() Node
- func OptGroup(children ...Node) Node
- func Option(children ...Node) Node
- func P(children ...Node) Node
- func Param(children ...Node) Node
- func Path(children ...Node) Node
- func Pattern(v string) Node
- func Picture(children ...Node) Node
- func Placeholder(v string) Node
- func PlaysInline() Node
- func Poster(v string) Node
- func Pre(children ...Node) Node
- func Preload(v string) Node
- func Progress(children ...Node) Node
- func Q(children ...Node) Node
- func Raw(t string) Node
- func RawScript(t string) Node
- func Rawf(format string, a ...interface{}) Node
- func ReadOnly() Node
- func Reduce(f func(prev Node, next Node) Node, children ...Node) Node
- func Rel(v string) Node
- func Required() Node
- func Role(v string) Node
- func RowSpan(v string) Node
- func Rows(v string) Node
- func S(children ...Node) Node
- func SVG(children ...Node) Node
- func Samp(children ...Node) Node
- func Script(children ...Node) Node
- func Section(children ...Node) Node
- func Select(children ...Node) Node
- func Selected() Node
- func Slot(children ...Node) Node
- func Small(children ...Node) Node
- func Source(children ...Node) Node
- func Span(children ...Node) Node
- func Src(v string) Node
- func SrcSet(v string) Node
- func Step(v string) Node
- func Stroke(v string) Node
- func StrokeWidth(v string) Node
- func Strong(children ...Node) Node
- func StyleAttribute(v string) Node
- func StyleElement(children ...Node) Node
- func Sub(children ...Node) Node
- func Summary(children ...Node) Node
- func Sup(children ...Node) Node
- func TBody(children ...Node) Node
- func TFoot(children ...Node) Node
- func THead(children ...Node) Node
- func TabIndex(v string) Node
- func Table(children ...Node) Node
- func Target(v string) Node
- func Td(children ...Node) Node
- func Template(children ...Node) Node
- func Text(t string) Node
- func Textarea(children ...Node) Node
- func Textf(format string, a ...interface{}) Node
- func Th(children ...Node) Node
- func Time(children ...Node) Node
- func Title(children ...Node) Node
- func TitleAttribute(v string) Node
- func TitleElement(children ...Node) Node
- func Tr(children ...Node) Node
- func Track(children ...Node) Node
- func Type(v string) Node
- func U(children ...Node) Node
- func Ul(children ...Node) Node
- func UnsafeRaw(t string) Node
- func UnsafeRawScript(t string) Node
- func UnsafeRawf(format string, a ...interface{}) Node
- func Value(v string) Node
- func Var(children ...Node) Node
- func Video(children ...Node) Node
- func ViewBox(v string) Node
- func Wbr(children ...Node) Node
- func Width(v string) Node
- func XSLTTemplat(v string) Node
- type NodeFunc
- type NodeType
- type NodeTypeDescriptor
- type Nodes
- type Swap
- func (s *Swap) FocusScroll(focusScroll bool) *Swap
- func (s *Swap) IgnoreTitle(ignoreTitle bool) *Swap
- func (s *Swap) Scroll(direction HxSwapDirection, target ...string) *Swap
- func (s *Swap) ScrollBottom(target ...string) *Swap
- func (s *Swap) ScrollTop(target ...string) *Swap
- func (s *Swap) Settle(swap ...time.Duration) *Swap
- func (s *Swap) Show(direction HxSwapDirection, target ...string) *Swap
- func (s *Swap) ShowBottom(target ...string) *Swap
- func (s *Swap) ShowTop(target ...string) *Swap
- func (s *Swap) String() string
- func (s *Swap) Style(style HXSwapStyle) *Swap
- func (s *Swap) Swap(swap ...time.Duration) *Swap
- func (s *Swap) Transition(transition bool) *Swap
Examples ¶
Constants ¶
const ( TriggerClick = "click" TriggerClickOnce = TriggerClick + " once" TriggerDblClick = JSEventTypeDblClickEvent TriggerKeyUpEnter = "keyup[keyCode==13]" TriggerEnterPressed = TriggerKeyUpEnter TriggerBlur = "blur" TriggerEvery1s = "every:1s" TriggerEvery2s = "every:2s" TriggerEvery5s = "every:5s" TriggerEvery10s = "every:10s" TriggerEvery30s = "every:30s" TriggerEvery1m = "every:1m" TriggerLoad = "onload" )
const ( ElementType = NodeType(iota) AttributeType )
const ( HxClssNameAddedSelector = ".htmx-added" HxClssNameIndicatorSelector = ".htmx-indicator" HxClssNameRequestSelector = ".htmx-request" HxClssNameSettlingSelector = ".htmx-settling" HxClssNameSwappingSelector = ".htmx-swapping" )
Variables ¶
var ( HxDefaultSwapDuration = 0 * time.Millisecond HxDefaultSettleDelay = 20 * time.Millisecond )
Functions ¶
func JSONSerializeOrEmpty ¶
JSONSerializeOrEmpty returns a JSON serialized string of the provided data or an empty string if the serialization fails.
Types ¶
type ClassNames ¶
ClassNames represents a set of class names.
func Merge ¶
func Merge(classNames ...ClassNames) ClassNames
Merge returns a new ClassNames object that is the result of merging the provided ClassNames objects.
func (ClassNames) Render ¶
func (c ClassNames) Render(w io.Writer) error
Render writes the class names to the provided writer.
func (ClassNames) String ¶
func (c ClassNames) String() string
String returns the string representation of the ClassNames.
func (ClassNames) Type ¶
func (c ClassNames) Type() NodeType
Type returns the node type of the ClassNames.
type ErrBoundaryFunc ¶
type ErrBoundaryFunc func() Node
ErrBoundaryFunc is a function that returns a node.
type FallbackFunc ¶
FallbackFunc is a function that returns a node.
type HTML5Props ¶
type HTML5Props struct {
// Title is the title of the HTML document.
Title string
// Description is the description of the HTML document.
Description string
// Language is the language of the HTML document.
Language string
// Head is the head section of the HTML document.
Head []Node
// Attributes are the attributes to be included in the HTML document.
Attributes []Node
}
HTML5Props represents the properties for an HTML5 document.
type HXSwapStyle ¶
type HXSwapStyle string
HxSwapStyle ...
const ( HxSwapInnerHTML HXSwapStyle = "innerHTML" HxSwapOuterHTML HXSwapStyle = "outerHTML" HxSwapBeforeBegin HXSwapStyle = "beforebegin" HxSwapAfterBegin HXSwapStyle = "afterbegin" HxSwapBeforeEnd HXSwapStyle = "beforeend" HxSwapAfterEnd HXSwapStyle = "afterend" HxSwapDelete HXSwapStyle = "delete" HxSwapNone HXSwapStyle = "none" )
type HxAttribute ¶
type HxAttribute string // https://htmx.org/reference/#attributes
const ( HxAttributeBoost HxAttribute = "hx-boost" HxAttributeGet HxAttribute = "hx-get" HxAttributePost HxAttribute = "hx-post" HxAttributePushURL HxAttribute = "hx-push-url" HxAttributeTarget HxAttribute = "hx-target" HxAttributeSelect HxAttribute = "hx-select" HxAttributeSelectOob HxAttribute = "hx-select-oob" HxAttributeSwap HxAttribute = "hx-swap" HxAttributeSwapOob HxAttribute = "hx-swap-oob" HxAttributeTrigger HxAttribute = "hx-trigger" HxAttributeConfirm HxAttribute = "hx-confirm" HxAttributePrompt HxAttribute = "hx-prompt" HxAttributeDelete HxAttribute = "hx-delete" HxAttributeOn HxAttribute = "hx-on" HxAttributePut HxAttribute = "hx-put" HxAttributePatch HxAttribute = "hx-patch" HxAttributeIndicator HxAttribute = "hx-indicator" HxAttributeEncoding HxAttribute = "hx-encoding" HxAttributeExt HxAttribute = "hx-ext" HxAttributeTarget404 HxAttribute = "hx-target-404" HxAttributeTarget403 HxAttribute = "hx-target-403" HxAttributeTarget401 HxAttribute = "hx-target-401" HxAttributeTarget500 HxAttribute = "hx-target-500" HxAttributeTarget5xx HxAttribute = "hx-target-5xx" HxAttributeTarget4xx HxAttribute = "hx-target-4xx" HxAttributeTargetError HxAttribute = "hx-target-error" HxAttributeTarget50x HxAttribute = "hx-target-50x" HxAttributeDisable HxAttribute = "hx-disable" HxAttributeDisabledElt HxAttribute = "hx-disabled-elt" HxAttributeValidate HxAttribute = "hx-validate" HxAttributeInclude HxAttribute = "hx-include" HxAttributeHeaders HxAttribute = "hx-headers" HxAttributeVars HxAttribute = "hx-vars" HxAttributeSync HxAttribute = "hx-sync" HxAttributeParams HxAttribute = "hx-params" HxAttributeVals HxAttribute = "hx-vals" )
func (HxAttribute) String ¶
func (a HxAttribute) String() string
type HxClassName ¶
type HxClassName string
HxClassName represents a class name for htmx elements.
const ( HxClassNameAdded HxClassName = "htmx-added" HxClassNameIndicator HxClassName = "htmx-indicator" HxClassNameRequest HxClassName = "htmx-request" HxClassNameSettling HxClassName = "htmx-settling" HxClassNameSwapping HxClassName = "htmx-swapping" )
func (HxClassName) String ¶
func (c HxClassName) String() string
String returns the string representation of the HxClassName.
type HxEventType ¶
type HxEventType string
HxEventType represents the type of htmx event.
const ( HxEventTypeAbort HxEventType = "htmx:abort" HxEventTypeAfterLoad HxEventType = "htmx:afterLoad" HxEventTypeAfterProcessNode HxEventType = "htmx:afterProcessNode" HxEventTypeAfterRequest HxEventType = "htmx:afterRequest" HxEventTypeBeforeHistorySaveEvent HxEventType = "htmx:beforeHistorySave" HxEventTypeBeforeOnAbort HxEventType = "htmx:beforeOnAbort" HxEventTypeBeforeOnConfigRequest HxEventType = "htmx:beforeOnConfigRequest" HxEventTypeBeforeOnConfigSwap HxEventType = "htmx:beforeOnConfigSwap" HxEventTypeBeforeOnConfigTrigger HxEventType = "htmx:beforeOnConfigTrigger" HxEventTypeBeforeOnError HxEventType = "htmx:beforeOnError" HxEventTypeBeforeOnLoad HxEventType = "htmx:beforeOnLoad" HxEventTypeBeforeOnRequest HxEventType = "htmx:beforeOnRequest" HxEventTypeBeforeOnSettle HxEventType = "htmx:beforeOnSettle" HxEventTypeBeforeOnSwap HxEventType = "htmx:beforeOnSwap" HxEventTypeBeforeOnTrigger HxEventType = "htmx:beforeOnTrigger" HxEventTypeBeforeRequest HxEventType = "htmx:beforeRequest" HxEventTypeBeforeSettle HxEventType = "htmx:beforeSettle" HxEventTypeBeforeSwap HxEventType = "htmx:beforeSwap" HxEventTypeConfigRequest HxEventType = "htmx:configRequest" HxEventTypeConfigSwap HxEventType = "htmx:configSwap" HxEventTypeConfigTrigger HxEventType = "htmx:configTrigger" HxEventTypeError HxEventType = "htmx:error" HxEventTypeHistoryCacheErrorEvent HxEventType = "htmx:historyCacheError" HxEventTypeHistoryCacheMissErrorEvent HxEventType = "htmx:historyCacheMissError" HxEventTypeHistoryCacheMissEvent HxEventType = "htmx:historyCacheMiss" HxEventTypeHistoryCacheMissLoadEvent HxEventType = "htmx:historyCacheMissLoad" HxEventTypeHistoryRestoreEvent HxEventType = "htmx:historyRestore" HxEventTypeLoad HxEventType = "htmx:load" HxEventTypeNoSSESourceErrorEvent HxEventType = "htmx:noSSESourceError" HxEventTypeOnAbort HxEventType = "htmx:onAbort" HxEventTypeOnConfigRequest HxEventType = "htmx:onConfigRequest" HxEventTypeOnConfigSwap HxEventType = "htmx:onConfigSwap" HxEventTypeOnConfigTrigger HxEventType = "htmx:onConfigTrigger" HxEventTypeOnError HxEventType = "htmx:onError" HxEventTypeOnLoad HxEventType = "htmx:onLoad" HxEventTypeOnLoadErrorEvent HxEventType = "htmx:onLoadError" HxEventTypeOnRequest HxEventType = "htmx:onRequest" HxEventTypeOnSettle HxEventType = "htmx:onSettle" HxEventTypeOnSwap HxEventType = "htmx:onSwap" HxEventTypeOnTrigger HxEventType = "htmx:onTrigger" HxEventTypeOobAfterSwapEvent HxEventType = "htmx:oobAfterSwap" HxEventTypeOobBeforeSwapEvent HxEventType = "htmx:oobBeforeSwap" HxEventTypePromptEvent HxEventType = "htmx:prompt" HxEventTypePushedIntoHistoryEvent HxEventType = "htmx:pushedIntoHistory" HxEventTypeRequest HxEventType = "htmx:request" HxEventTypeResponseErrorEvent HxEventType = "htmx:responseError" HxEventTypeSendErrorEvent HxEventType = "htmx:sendError" HxEventTypeSettle HxEventType = "htmx:settle" HxEventTypeSseAfterMessageEvent HxEventType = "htmx:sseAfterMessage" HxEventTypeSseBeforeMessageEvent HxEventType = "htmx:sseBeforeMessage" HxEventTypeSseClosedEvent HxEventType = "htmx:sseClose" HxEventTypeSseConnectedEvent HxEventType = "htmx:sseOpen" HxEventTypeSseConnectingEvent HxEventType = "htmx:sseConnecting" HxEventTypeSseErrorEvent HxEventType = "htmx:sseError" HxEventTypeSSEErrorEvent HxEventType = "htmx:sseError" HxEventTypeSSEOpenEvent HxEventType = "htmx:sseOpen" HxEventTypeSwap HxEventType = "htmx:swap" HxEventTypeSwapErrorEvent HxEventType = "htmx:swapError" HxEventTypeTargetErrorEvent HxEventType = "htmx:targetError" HxEventTypeTimeoutEvent HxEventType = "htmx:timeout" HxEventTypeTrigger HxEventType = "htmx:trigger" HxEventTypeValidationFailedEvent HxEventType = "htmx:validation:failed" HxEventTypeValidationHaltedEvent HxEventType = "htmx:validation:halted" HxEventTypeValidationValidateEvent HxEventType = "htmx:validation:validate" HxEventTypeXhrAbortEvent HxEventType = "htmx:xhr:abort" HxEventTypeXhrLoadEndEvent HxEventType = "htmx:xhr:loadend" HxEventTypeXhrLoadStartEvent HxEventType = "htmx:xhr:loadstart" HxEventTypeXhrProgressEvent HxEventType = "htmx:xhr:progress" HxEventTypeOobErrorNoTargetEvent HxEventType = "htmx:oobErrorNoTarget" )
List of predefined htmx event types. See: https://htmx.org/reference/#events
func (HxEventType) String ¶
func (e HxEventType) String() string
String returns the string representation of the HxEventType.
type HxExtType ¶
type HxExtType string
HxExtType is a type for htmx extension types.
const ( HXDebug HxExtType = "debug" // The debug extension allows you to debug htmx requests. HxExtClassTools HxExtType = "class-tools" // The class-tools extension allows you to add and remove classes from elements. HxExtClientSideTemplates HxExtType = "client-side-templates" // The client-side-templates extension allows you to use client-side templates to render the response. HxExtIgnoreDebug HxExtType = "ignore:debug" // The ignore:debug extension allows you to ignore the debug header. HxExtJSON HxExtType = "json-enc" // The json-enc extension allows you to specify the JSON encoding for the response. HxExtMultiSwap HxExtType = "multi-swap" // The multi-swap extension allows you to swap multiple elements in a single response. HxExtPathDeps HxExtType = "path-deps" // The path-deps extension allows you to specify the dependencies for a path. HxExtSSE HxExtType = "sse" // The sse extension allows you to use Server-Sent Events (SSE) to stream updates to the client. HxResponseTargets HxExtType = "response-targets" // The response-target extension allows you to specify the target for the response. )
type HxSwapDirection ¶
type HxSwapDirection string
HxSwapDirection ...
const ( HxSwapDirectionTop HxSwapDirection = "top" HxSwapDirectionBottom HxSwapDirection = "bottom" )
type HxSwapScrolling ¶
type HxSwapScrolling struct {
// contains filtered or unexported fields
}
HxSwapScrolling ...
type HxSwapScrollingMode ¶
type HxSwapScrollingMode string
HxSwapScrollingMode ...
const ( HxSwapScrollingScroll HxSwapScrollingMode = "scroll" HxSwapScrollingShow HxSwapScrollingMode = "show" )
type HxSwapTiming ¶
type HxSwapTiming struct {
// contains filtered or unexported fields
}
HxSwapTiming ...
type HxSwapTimingMode ¶
type HxSwapTimingMode string
HxSwapTimingMode ...
const ( HxTimingSwap HxSwapTimingMode = "swap" HxTimingSettle HxSwapTimingMode = "settle" )
type ImportMap ¶
type ImportMap struct {
// Imports is a map of module specifiers to URLs.
Imports map[string]string `json:"imports"`
// Scopes is a map of scopes to maps of module specifiers to URLs.
Scopes map[string]map[string]string `json:"scopes,omitempty"`
// Integrity is a map of URLs to integrity metadata.
Integrity map[string]string `json:"integrity,omitempty"`
}
ImportMap is a struct that represents an import map. sse https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap
type ImportsProp ¶
type ImportsProp struct {
Pkgs []imports.ExactPackage
Requires []imports.Require
Resolver imports.Resolver
}
ImportsProp ...
type JSEventType ¶
type JSEventType string
JSEventType represents the type of JavaScript event.
const ( JSEventTypeClickEvent JSEventType = "onclick" JSEventTypeChangeEvent JSEventType = "onchange" JSEventTypeInputEvent JSEventType = "oninput" JSEventTypeFocusEvent JSEventType = "onfocus" JSEventTypeBlurEvent JSEventType = "onblur" JSEventTypeKeyDownEvent JSEventType = "onkeydown" JSEventTypeKeyUpEvent JSEventType = "onkeyup" JSEventTypeKeyPressEvent JSEventType = "onkeypress" JSEventTypeSubmitEvent JSEventType = "onsubmit" JSEventTypeLoadDomEvent JSEventType = "onload" JSEventTypeLoadEvent JSEventType = "onload" JSEventTypeUnloadEvent JSEventType = "onunload" JSEventTypeResizeEvent JSEventType = "onresize" JSEventTypeScrollEvent JSEventType = "onscroll" JSEventTypeDblClickEvent JSEventType = "ondblclick" JSEventTypeMouseOverEvent JSEventType = "onmouseover" JSEventTypeMouseOutEvent JSEventType = "onmouseout" JSEventTypeMouseMoveEvent JSEventType = "onmousemove" JSEventTypeMouseDownEvent JSEventType = "onmousedown" JSEventTypeMouseUpEvent JSEventType = "onmouseup" JSEventTypeContextMenuEvent JSEventType = "oncontextmenu" JSEventTypeDragStartEvent JSEventType = "ondragstart" JSEventTypeDragEvent JSEventType = "ondrag" JSEventTypeDragEnterEvent JSEventType = "ondragenter" JSEventTypeDragLeaveEvent JSEventType = "ondragleave" JSEventTypeDragOverEvent JSEventType = "ondragover" JSEventTypeDropEvent JSEventType = "ondrop" JSEventTypeDragEndEvent JSEventType = "ondragend" )
List of predefined JavaScript event types.
func (JSEventType) String ¶
func (e JSEventType) String() string
String returns the string representation of the JSEventType.
type Node ¶
Node is a node in the HTML tree.
func Attribute ¶
Attribute is a node that renders an HTML attribute.
Example (Bool) ¶
package main
import (
"os"
htmx "github.com/katallaxie/htmx"
"github.com/katallaxie/pkg/conv"
)
func main() {
_ = htmx.Attribute("disabled", conv.String(true)).Render(os.Stdout)
}
Output: disabled="true"
Example (Name_value) ¶
package main
import (
"os"
htmx "github.com/katallaxie/htmx"
)
func main() {
_ = htmx.Attribute("href", "/").Render(os.Stdout)
}
Output: href="/"
func AutoComplete ¶
AutoComplete sets the autocomplete attribute for form elements.
func BlockQuote ¶
BlockQuote represents an HTML blockquote element.
func ClipRule ¶
ClipRule returns an SVG attribute node for specifying the clip rule. The clip rule determines how the clipping path is applied to the SVG element. The value of the clip rule is specified as a string. Example usage: ClipRule("evenodd").
func ContentEditable ¶
ContentEditable sets the contenteditable attribute for elements.
func CrossOrigin ¶
CrossOrigin sets the crossorigin attribute for elements.
func CustomElement ¶
CustomElement represents a custom HTML element.
func D ¶
D returns an SVG attribute node for specifying the path data. The path data defines the shape of the SVG path element. The value of the path data is specified as a string. Example usage: D("M10 10 L20 20").
func DataAttribute ¶
DataAttribute sets the data-{name} attribute for elements.
func DataElement ¶
DataElement represents an HTML data element.
func ErrorBoundary ¶
func ErrorBoundary(n ErrBoundaryFunc) Node
ErrorBoundary is a node that catches panics and renders an error.
func ErrorExists ¶
func ErrorExists[K comparable](e Errors[K], key K, fn func(k K, v error) Node) Node
ErrorExists is a node that renders a child node if an error exists.
func Fallback ¶
func Fallback(n Node, f FallbackFunc) Node
Fallback is a node that renders a fallback node if a condition is false.
func FigCaption ¶
FigCaption represents an HTML figcaption element.
func Fill ¶
Fill returns an SVG attribute node for specifying the fill color. The fill color determines the color used to fill the SVG element. The value of the fill color is specified as a string. Example usage: Fill("red").
func FillRule ¶
FillRule returns an SVG attribute node for specifying the fill rule. The fill rule determines how the interior of the SVG element is filled. The value of the fill rule is specified as a string. Example usage: FillRule("evenodd").
func FormAttribute ¶
FormAttribute sets the form attribute for elements.
func FormElement ¶
FormElement represents an HTML form element.
func G ¶
G creates an SVG group element with the specified children. It is a convenience function that calls the Element function with "g" as the tag name.
func HTML5 ¶
func HTML5(props HTML5Props, body ...Node) Node
HTML5 generates an HTML5 document based on the provided properties.
func HandlebarsTemplate ¶
HandlebarsTemplate sets the handlebars-template attribute to specify the handlebars template for the response.
func HxDisable ¶
func HxDisable() Node
HxDisable sets the hx-disable attribute to disable htmx functionality.
func HxDisabledElt ¶
HxDisabledElt sets the hx-disable-elt attribute to disable the target element.
func HxEncoding ¶
HxEncoding sets the hx-encoding attribute to specify the encoding type for form submission.
func HxInclude ¶
HxInclude sets the hx-include attribute to specify the target element for inclusion.
func HxIndicator ¶
HxIndicator sets the hx-indicator attribute to specify the target element for showing an indicator.
func HxOn ¶
HxOn sets the hx-put-{target} attribute to specify the JavaScript code to execute on a PUT request.
func HxSSE ¶
func HxSSE() Node
HxSSE sets the sse attribute to specify the Server-Sent Events (SSE) URL.
func HxSSEConnect ¶
HxSSEConnect sets the sse-connect attribute to specify the Server-Sent Events (SSE) URL.
func HxSSESwap ¶
HxSSESwap sets the sse-swap attribute to specify the Server-Sent Events (SSE) swap.
func HxSelectOob ¶
HxSelectOob sets the hx-select-oob attribute to specify the target element for out-of-band selection.
func HxSwapOob ¶
HxSwapOob sets the hx-swap-oob attribute to specify the target element for out-of-band swapping.
func HxTarget ¶
HxTarget sets the hx-target attribute to specify the target element for the response.
func HxTarget4xx ¶
HxTarget4xx sets the hx-target-4xx attribute to specify the target element for 4xx responses.
func HxTarget5xx ¶
HxTarget5xx sets the hx-target-5xx attribute to specify the target element for 5xx responses.
func HxTarget50x ¶
HxTarget50x sets the hx-target-50x attribute to specify the target element for 50x responses.
func HxTarget401 ¶
HxTarget401 sets the hx-target-401 attribute to specify the target element for 401 responses.
func HxTarget403 ¶
HxTarget403 sets the hx-target-403 attribute to specify the target element for 403 responses.
func HxTarget404 ¶
HxTarget404 sets the hx-target-404 attribute to specify the target element for 404 responses.
func HxTarget500 ¶
HxTarget500 sets the hx-target-500 attribute to specify the target element for 500 responses.
func HxTargetError ¶
HxTargetError sets the hx-target-error attribute to specify the target element for error responses.
func HxTrigger ¶
HxTrigger sets the hx-trigger attribute to specify the target element for triggering an event.
func HxValidate ¶
HxValidate sets the hx-validate attribute to enable or disable form validation.
func HyperScript ¶
HyperScript sets the _ attribute to specify the hyperscript for the response.
func IfElse ¶
IfElse is a node that renders a child node if a condition is true, otherwise it renders another child node.
func JSEvent ¶
func JSEvent(e JSEventType, value ...string) Node
JSEvent is a type that represents JavaScript events.
func KeyExists ¶
func KeyExists[K comparable, V any](m map[K]V, key K, fn func(k K, v V) Node) Node
KeyExists is a node that renders a child node if a key exists in a map.
func MustacheTemplate ¶
MustacheTemplate sets the mustache-template attribute to specify the mustache template for the response.
func NoValidate ¶
func NoValidate() Node
NoValidate sets the novalidate attribute for form elements.
func NunjucksTemplate ¶
NunjucksTemplate sets the nunjucks-template attribute to specify the nunjucks template for the response.
func OnePasswordIgnore ¶
func OnePasswordIgnore() Node
OnePasswordIgnore sets the data-1p-ignore attribute for elements.
func Path ¶
Path creates an SVG path element with the specified children. It is a convenience function that calls the Element function with "path" as the tag name.
func Placeholder ¶
Placeholder sets the placeholder attribute for input elements.
func PlaysInline ¶
func PlaysInline() Node
PlaysInline sets the playsinline attribute for media elements.
func SVG ¶
SVG creates an SVG element with the specified children. It sets the "xmlns" attribute to "http://www.w3.org/2000/svg". The children are rendered inside a group element.
func Stroke ¶
Stroke returns an SVG attribute node for specifying the stroke color. The stroke color determines the color used to stroke the SVG element. The value of the stroke color is specified as a string. Example usage: Stroke("blue").
func StrokeWidth ¶
StrokeWidth returns an SVG attribute node for specifying the stroke width. The stroke width determines the thickness of the stroke applied to an SVG element. The value of the stroke width is specified as a string. Example usage: StrokeWidth("2px").
func StyleAttribute ¶
StyleAttribute sets the style attribute for elements.
func StyleElement ¶
StyleElement represents an HTML style element.
func TitleAttribute ¶
TitleAttribute sets the title attribute for elements.
func TitleElement ¶
TitleElement represents an HTML title element.
func UnsafeRawScript ¶
UnsafeRawScript is a node that renders an unsafe raw script.
func UnsafeRawf ¶
UnsafeRawf is a node that renders an unsafe formatted raw HTML.
func ViewBox ¶
ViewBox returns an SVG attribute node for specifying the viewBox. The viewBox defines the position and size of the SVG element's viewport. The value of the viewBox is specified as a string. Example usage: ViewBox("0 0 100 100").
func XSLTTemplat ¶
XSLTTemplat sets the xslt-template attribute to specify the xslt template for the response.
type NodeFunc ¶
NodeFunc is a function that renders a node.
func Element ¶
Element is a node that renders an HTML element.
Example (A) ¶
_ = Element("a").Render(os.Stdout)
Output: <a></a>
Example (Div) ¶
_ = Element("div").Render(os.Stdout)
Output: <div></div>
Example (Tag) ¶
package main
import (
"os"
htmx "github.com/katallaxie/htmx"
)
func main() {
_ = htmx.Element("div").Render(os.Stdout)
}
Output: <div></div>
type NodeTypeDescriptor ¶
type NodeTypeDescriptor interface {
Type() NodeType
}
NodeTypeDescriptor is a node that has a type.
type Nodes ¶
type Nodes []Node
Nodes is a slice of nodes.
type Swap ¶
type Swap struct {
// contains filtered or unexported fields
}
Swap ...
func (*Swap) FocusScroll ¶
FocusScroll is a boolean attribute that indicates whether the element should be scrolled into view after the swap.
func (*Swap) IgnoreTitle ¶
IgnoreTitle is a boolean attribute that indicates whether the title of the page should be ignored.
func (*Swap) Scroll ¶
func (s *Swap) Scroll(direction HxSwapDirection, target ...string) *Swap
Scroll ...
func (*Swap) Settle ¶
Settle modifies the amount of time that htmx will wait after receiving a response to settle the content.
func (*Swap) Swap ¶
Swap modifies the amount of time that htmx will wait after receiving a response to swap the content.
func (*Swap) Transition ¶
Transition is a boolean attribute that indicates whether the swap should be animated.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
cli
command
|
|
|
heroicons
command
|
|
|
sidekickicons
command
|
|
|
tailwind
command
|
|
|
Package icons provides a set of icons for use in the application.
|
Package icons provides a set of icons for use in the application. |
|
heroicons
Code generated by herogen; DO NOT EDIT.
|
Code generated by herogen; DO NOT EDIT. |
|
sidekickicons
Code generated by herogen; DO NOT EDIT.
|
Code generated by herogen; DO NOT EDIT. |
|
internal
|
|