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 AriaLabel(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 Command(v string) Node
- func CommandFor(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 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 Popover() 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 Style(children ...Node) Node
- func StyleAttribute(v string) 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) Read ΒΆ added in v0.5.4
func (c ClassNames) Read(p []byte) (int, error)
Read reads the class names into the provided byte slice.
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 is used to define the scrolling behavior of the swap operation.
func (*HxSwapScrolling) String ΒΆ
func (s *HxSwapScrolling) String() string
String is used to return the string representation of the hx-swap-scrolling attribute.
type HxSwapScrollingMode ΒΆ
type HxSwapScrollingMode string
HxSwapScrollingMode ...
const ( HxSwapScrollingScroll HxSwapScrollingMode = "scroll" HxSwapScrollingShow HxSwapScrollingMode = "show" )
type HxSwapTiming ΒΆ
type HxSwapTiming struct {
// contains filtered or unexported fields
}
HxSwapTiming is used to define the timing of the swap operation.
func (*HxSwapTiming) String ΒΆ
func (s *HxSwapTiming) String() string
String returns the string representation of the hx-swap attribute.
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 Command ΒΆ added in v0.5.5
Command sets the command following the https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API.
func CommandFor ΒΆ added in v0.5.5
CommandFor sets the command following the https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API.
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 Popover ΒΆ added in v0.5.5
func Popover() Node
Popover make a element a popover target. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/popover
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 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 is a component for the htmx swap extension.
func NewSwap ΒΆ
func NewSwap() *Swap
NewSwap creates a new Swap instance with the default style set to HxSwapInnerHTML.
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) Show ΒΆ
func (s *Swap) Show(direction HxSwapDirection, target ...string) *Swap
Show ...
func (*Swap) Style ΒΆ
func (s *Swap) Style(style HXSwapStyle) *Swap
Style sets the style of the swap operation.
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 |
|---|---|
|
Package alerts provides functionality for managing and processing alerts within the system.
|
Package alerts provides functionality for managing and processing alerts within the system. |
|
Package avatars provides components for rendering user avatars.
|
Package avatars provides components for rendering user avatars. |
|
Package badges provides components for rendering user badges.
|
Package badges provides components for rendering user badges. |
|
Package breadcrumbs provides components for rendering breadcrumbs.
|
Package breadcrumbs provides components for rendering breadcrumbs. |
|
Package buttons provides components for rendering buttons.
|
Package buttons provides components for rendering buttons. |
|
cmd
|
|
|
cli
command
|
|
|
heroicons
command
|
|
|
sidekickicons
command
|
|
|
tailwind
command
|
|
|
badge
command
|
|
|
datalist
command
|
|
|
drawer
command
|
|
|
filter
command
|
|
|
heroicons
command
|
|
|
indicator
command
|
|
|
login
command
|
|
|
modal
command
|
|
|
tables
command
|
|
|
Package forms contains form components such as Filter and FilterOption.
|
Package forms contains form components such as Filter and FilterOption. |
|
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
|
|
|
Package modals provides structures and methods for handling modal dialogs in a web application.
|
Package modals provides structures and methods for handling modal dialogs in a web application. |
|
Package skeletons provides skeleton components for various UI elements.
|
Package skeletons provides skeleton components for various UI elements. |
|
Package `toasts` provides a simple way to display toast notifications in a web application.
|
Package `toasts` provides a simple way to display toast notifications in a web application. |