Documentation ¶
Index ¶
- Constants
- Variables
- func AsBool(str string) bool
- func AsStr(v bool) string
- func ContextWithHx(c *fiber.Ctx) *fiber.Ctx
- func ControllerErrorHandler(ctrl Controller) fiber.ErrorHandler
- func IntAsString(v int) string
- func Locals[V any](c Ctx, key any, value ...V) V
- func New(config ...Config) fiber.Handler
- func NewCompFuncHandler(handler CompFunc, config ...Config) fiber.Handler
- func NewCompHandler(n Node, config ...Config) fiber.Handler
- func NewHtmxHandler(handler HtmxHandlerFunc, config ...Config) fiber.Handler
- func NewHxControllerHandler(ctrl Controller, config ...Config) fiber.Handler
- func Static() fs.FS
- type ClassNames
- type CompFunc
- type Config
- type ContextFunc
- type Controller
- type Ctx
- type DefaultContext
- func (c *DefaultContext) Locals(key any, value ...any) (val any)
- func (c *DefaultContext) Path() string
- func (c *DefaultContext) Reset()
- func (c *DefaultContext) Values(key any, value ...any) (val any)
- func (c *DefaultContext) ValuesBool(key any, value ...any) (val bool)
- func (c *DefaultContext) ValuesInt(key any, value ...any) (val int)
- func (c *DefaultContext) ValuesString(key any, value ...any) (val string)
- type DefaultController
- func (c *DefaultController) BindBody(obj interface{}) error
- func (c *DefaultController) BindParams(obj interface{}) error
- func (c *DefaultController) BindQuery(obj interface{}) error
- func (c *DefaultController) Delete() error
- func (c *DefaultController) Error(err error) error
- func (c *DefaultController) Finalize() error
- func (c *DefaultController) Get() error
- func (c *DefaultController) Head() error
- func (c *DefaultController) Hx() *Htmx
- func (c *DefaultController) Init(hx *Htmx) error
- func (c *DefaultController) Options() error
- func (c *DefaultController) Patch() error
- func (c *DefaultController) Post() error
- func (c *DefaultController) Prepare() error
- func (c *DefaultController) Put() error
- func (c *DefaultController) Trace() error
- type FilterFunc
- type HTML5Props
- type HXSwapStyle
- type Htmx
- func (h *Htmx) Context() *fiber.Ctx
- func (h *Htmx) Ctx() *fiber.Ctx
- func (h *Htmx) IsHxBoosted() bool
- func (h *Htmx) IsHxHistoryRestoreRequest() bool
- func (h *Htmx) IsHxRequest() bool
- func (h *Htmx) ReSelect(target string)
- func (h *Htmx) ReSwap(target string)
- func (h *Htmx) ReTarget(target string)
- func (h *Htmx) Redirect(url string)
- func (h *Htmx) RenderComp(n Node, opt ...RenderOpt) error
- func (h *Htmx) RenderPartial() bool
- func (h *Htmx) ReplaceURL(url string)
- func (h *Htmx) StopPolling() error
- func (h *Htmx) Trigger(target string)
- func (h *Htmx) Write(data []byte) (n int, err error)
- func (h *Htmx) WriteHTML(html template.HTML) (n int, err error)
- func (h *Htmx) WriteJSON(data any) (n int, err error)
- func (h *Htmx) WriteString(s string) (n int, err error)
- type HtmxHandlerFunc
- type Hx
- type HxClassName
- type HxEventType
- type HxExtType
- type HxRequestHeader
- type HxResponseHeader
- type HxResponseHeaders
- type HxSwapDirection
- type HxSwapScrolling
- type HxSwapScrollingMode
- type HxSwapTiming
- type HxSwapTimingMode
- 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 Controls() 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 EncType(v string) 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(i int) 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 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(ctx Ctx, 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 HxInclude(target string) Node
- func HxIndicator(target string) Node
- func HxOn(target string, js string) Node
- func HxPath(url string) Node
- func HxPost(url string) Node
- func HxPrompt(msg string) Node
- func HxPushUrl(v bool) Node
- func HxPut(url 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 HxTrigger(target 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 Img(children ...Node) Node
- func Input(children ...Node) Node
- func Ins(children ...Node) Node
- func Is(v string) Node
- func Kbd(children ...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 Loading(v string) Node
- func Loop() Node
- func Main(children ...Node) Node
- func Map(f func(i int) Node, children ...Node) []Node
- func Mark(children ...Node) 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 NunjucksTemplate(v string) Node
- func Object(children ...Node) Node
- func Ol(children ...Node) Node
- func OnClick(v string) 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 Rawf(format string, a ...interface{}) Node
- func ReadOnly() Node
- func Reduce(f func(Node, 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 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 RangeLoop
- type RenderOpt
- 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
- type UnimplementedContext
- func (u *UnimplementedContext) Path() string
- func (u *UnimplementedContext) Values(key any, value ...any) (val any)
- func (u *UnimplementedContext) ValuesBool(key any, value ...any) (val bool)
- func (u *UnimplementedContext) ValuesInt(key any, value ...any) (val int)
- func (u *UnimplementedContext) ValuesString(key any, value ...any) (val string)
- type UnimplementedController
Examples ¶
Constants ¶
const ( ElementType = NodeType(iota) AttributeType )
const (
// StatusStopPolling is a helper status code to stop polling.
StatusStopPolling = 286
)
Variables ¶
var ( HxDefaultSwapDuration = 0 * time.Millisecond HxDefaultSettleDelay = 20 * time.Millisecond )
var ConfigDefault = Config{ ErrorHandler: defaultErrorHandler, Filters: []FilterFunc{}, }
ConfigDefault is the default config.
Functions ¶
func AsBool ¶
AsBool is a helper function that returns a boolean value based on the provided string.
func AsStr ¶ added in v1.0.1
AsStr is a helper function that returns a string value based on the provided boolean.
func ControllerErrorHandler ¶ added in v1.1.42
func ControllerErrorHandler(ctrl Controller) fiber.ErrorHandler
ControllerErrorHandler is a helper type for controller error handlers.
func IntAsString ¶ added in v1.0.16
IntAsString is a helper function that returns a string value based on the provided integer.
func NewCompFuncHandler ¶ added in v1.0.4
NewCompFuncHandler returns a new comp handler.
func NewCompHandler ¶ added in v1.0.1
NewCompHandler returns a new comp handler.
func NewHtmxHandler ¶
func NewHtmxHandler(handler HtmxHandlerFunc, config ...Config) fiber.Handler
NewHtmxHandler returns a new htmx handler.
func NewHxControllerHandler ¶ added in v1.0.42
func NewHxControllerHandler(ctrl Controller, config ...Config) fiber.Handler
NewHxControllerHandler returns a new htmx controller handler. nolint:gocyclo
Types ¶
type ClassNames ¶ added in v1.0.1
ClassNames represents a set of class names.
func Merge ¶ added in v1.0.28
func Merge(classNames ...ClassNames) ClassNames
Merge returns a new ClassNames object that is the result of merging the provided ClassNames objects.
func (ClassNames) Merge ¶ added in v1.0.4
func (c ClassNames) Merge(classNames ClassNames) ClassNames
Merge merges the provided class names into the class names.
func (ClassNames) Render ¶ added in v1.0.1
func (c ClassNames) Render(w io.Writer) error
Render writes the class names to the provided writer.
func (ClassNames) String ¶ added in v1.0.1
func (c ClassNames) String() string
String returns the string representation of the ClassNames.
func (ClassNames) Type ¶ added in v1.0.1
func (c ClassNames) Type() NodeType
Type returns the node type of the ClassNames.
type Config ¶
type Config struct { // Next defines a function to skip this middleware when returned true. Next func(c *fiber.Ctx) bool // Filters is a list of filters that filter the context. Filters []FilterFunc // ErrorHandler is executed when an error is returned from fiber.Handler. // // Optional. Default: DefaultErrorHandler ErrorHandler fiber.ErrorHandler }
Config ...
type ContextFunc ¶ added in v1.1.46
ContextFunc is a function that returns a context.
type Controller ¶ added in v1.0.42
type Controller interface { // Init is called when the controller is initialized. Init(hx *Htmx) error // Prepare is called before the controller is executed. Prepare() error // Finalize is called after the controller is executed. Finalize() error // Get is called when the controller is executed with the GET method. Get() error // Post is called when the controller is executed with the POST method. Post() error // Put is called when the controller is executed with the PUT method. Put() error // Patch is called when the controller is executed with the PATCH method. Patch() error // Delete is called when the controller is executed with the DELETE method. Delete() error // Options is called when the controller is executed with the OPTIONS method. Options() error // Trace is called when the controller is executed with the TRACE method. Trace() error // Head is called when the controller is executed with the HEAD method. Head() error // Error is called when an error occurs. Error(err error) error }
Controller is the interface for the htmx controller.
type Ctx ¶ added in v1.0.26
type Ctx interface { // Values is a helper function to get the values from the context. Values(key any, value ...any) (val any) // ValuesString is a helper function to get the values as a string from the context. ValuesString(key any, value ...any) (val string) // ValuesInt is a helper function to get the values as an int from the context. ValuesInt(key any, value ...any) (val int) // ValuesBool is a helper function to get the values as a bool from the context. ValuesBool(key any, value ...any) (val bool) // Path is a helper function to get the path from the context. Path() string }
Ctx is the component context.
type DefaultContext ¶ added in v1.1.46
DefaultContext is a helper type for default contexts.
func NewDefaultContext ¶ added in v1.1.46
func NewDefaultContext(ctx *fiber.Ctx, funcs ...ContextFunc) (*DefaultContext, error)
NewDefaultContext returns a new default context.
func (*DefaultContext) Locals ¶ added in v1.1.46
func (c *DefaultContext) Locals(key any, value ...any) (val any)
Locals is a method that returns the local values.
func (*DefaultContext) Path ¶ added in v1.1.46
func (c *DefaultContext) Path() string
Path is a method that returns the path.
func (*DefaultContext) Reset ¶ added in v1.1.46
func (c *DefaultContext) Reset()
Reset is a method that resets the local values.
func (*DefaultContext) Values ¶ added in v1.1.46
func (c *DefaultContext) Values(key any, value ...any) (val any)
Values is a method that returns the local values.
func (*DefaultContext) ValuesBool ¶ added in v1.1.46
func (c *DefaultContext) ValuesBool(key any, value ...any) (val bool)
ValuesBool is a method that returns the local values.
func (*DefaultContext) ValuesInt ¶ added in v1.1.46
func (c *DefaultContext) ValuesInt(key any, value ...any) (val int)
ValuesInt is a method that returns the local values.
func (*DefaultContext) ValuesString ¶ added in v1.1.46
func (c *DefaultContext) ValuesString(key any, value ...any) (val string)
ValuesString is a method that returns the local values.
type DefaultController ¶ added in v1.1.43
UnimplementedController is the default controller implementation.
func NewDefaultController ¶ added in v1.1.43
func NewDefaultController() *DefaultController
NewDefaultController returns a new default controller.
func (*DefaultController) BindBody ¶ added in v1.1.44
func (c *DefaultController) BindBody(obj interface{}) error
BindForm binds the form to the given struct.
func (*DefaultController) BindParams ¶ added in v1.1.44
func (c *DefaultController) BindParams(obj interface{}) error
BindParams binds the params to the given struct.
func (*DefaultController) BindQuery ¶ added in v1.1.44
func (c *DefaultController) BindQuery(obj interface{}) error
BindQuery binds the query to the given struct.
func (*DefaultController) Delete ¶ added in v1.1.43
func (c *DefaultController) Delete() error
Delete is called when the controller is executed with the DELETE method.
func (*DefaultController) Error ¶ added in v1.1.43
func (c *DefaultController) Error(err error) error
Error is called when an error occurs.
func (*DefaultController) Finalize ¶ added in v1.1.43
func (c *DefaultController) Finalize() error
Finalize is called after the controller is executed.
func (*DefaultController) Get ¶ added in v1.1.43
func (c *DefaultController) Get() error
Get is called when the controller is executed with the GET method.
func (*DefaultController) Head ¶ added in v1.1.44
func (c *DefaultController) Head() error
Head is called when the controller is executed with the HEAD method.
func (*DefaultController) Hx ¶ added in v1.1.43
func (c *DefaultController) Hx() *Htmx
Hx returns the htmx instance.
func (*DefaultController) Init ¶ added in v1.1.43
func (c *DefaultController) Init(hx *Htmx) error
Init is called when the controller is initialized.
func (*DefaultController) Options ¶ added in v1.1.43
func (c *DefaultController) Options() error
Options is called when the controller is executed with the OPTIONS method.
func (*DefaultController) Patch ¶ added in v1.1.43
func (c *DefaultController) Patch() error
Patch is called when the controller is executed with the PATCH method.
func (*DefaultController) Post ¶ added in v1.1.43
func (c *DefaultController) Post() error
Post is called when the controller is executed with the POST method.
func (*DefaultController) Prepare ¶ added in v1.1.43
func (c *DefaultController) Prepare() error
Prepare is called before the controller is executed.
func (*DefaultController) Put ¶ added in v1.1.43
func (c *DefaultController) Put() error
Put is called when the controller is executed with the PUT method.
func (*DefaultController) Trace ¶ added in v1.1.43
func (c *DefaultController) Trace() error
Trace is called when the controller is executed with the TRACE method.
type FilterFunc ¶ added in v1.1.44
FilterFunc is a function that filters the context.
type HTML5Props ¶ added in v1.0.1
type HTML5Props struct { Title string // The title of the HTML document. Description string // The description of the HTML document. Language string // The language of the HTML document. Head []Node // The nodes to be included in the head section of the HTML document. Attributes []Node // The attributes to be included in the HTML document. }
HTML5Props represents the properties for an HTML5 document.
type HXSwapStyle ¶ added in v1.0.2
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 Htmx ¶
Htmx is a helper struct for htmx requests.
func (*Htmx) Context ¶ added in v1.0.42
func (h *Htmx) Context() *fiber.Ctx
Context is a method that returns the fiber context.
func (*Htmx) IsHxBoosted ¶
IsHxBoosted returns true if the request is an htmx request.
func (*Htmx) IsHxHistoryRestoreRequest ¶
IsHxHistoryRestoreRequest returns true if the request is an htmx request.
func (*Htmx) IsHxRequest ¶
IsHxRequest returns true if the request is an htmx request.
func (*Htmx) RenderComp ¶ added in v1.0.1
RenderComp is a helper function to render a component.
func (*Htmx) RenderPartial ¶
RenderPartial returns true if the request is an htmx request.
func (*Htmx) ReplaceURL ¶
ReplaceURL is a helper function to replace the current URL.
type Hx ¶
type Hx struct { HxBoosted bool HxCurrentURL string HxHistoryRestoreRequest bool HxPrompt string HxRequest bool HxTarget string HxTriggerName string HxTrigger string }
Hx ...
type HxClassName ¶ added in v1.0.1
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 ¶ added in v1.0.1
func (c HxClassName) String() string
String returns the string representation of the HxClassName.
type HxEventType ¶ added in v1.0.1
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" )
List of predefined htmx event types.
func (HxEventType) String ¶ added in v1.0.1
func (e HxEventType) String() string
String returns the string representation of the HxEventType.
type HxExtType ¶ added in v1.0.33
type HxExtType string
HxExtType is a type for htmx extension types.
const ( HxExtAlpineMorph HxExtType = "alpine-morph" HxExtClassTools HxExtType = "class-tools" HxExtClientSideTemplates HxExtType = "client-side-templates" HxExtIgnoreDebug HxExtType = "ignore:debug" HxExtJSON HxExtType = "json-enc" HxExtMultiSwap HxExtType = "multi-swap" HxExtPathDeps HxExtType = "path-deps" )
type HxRequestHeader ¶
type HxRequestHeader string
HxRequestHeader is a helper type for htmx request headers.
const ( HxRequestHeaderBoosted HxRequestHeader = "HX-Boosted" HxRequestHeaderCurrentURL HxRequestHeader = "HX-Current-URL" HxRequestHeaderHistoryRestoreRequest HxRequestHeader = "HX-History-Restore-Request" HxRequestHeaderPrompt HxRequestHeader = "HX-Prompt" HxRequestHeaderRequest HxRequestHeader = "HX-Request" HxRequestHeaderTarget HxRequestHeader = "HX-Target" HxRequestHeaderTrigger HxRequestHeader = "HX-Trigger" HxRequestHeaderTriggerName HxRequestHeader = "HX-Trigger-Name" )
func (HxRequestHeader) String ¶
func (h HxRequestHeader) String() string
String returns the header as a string.
type HxResponseHeader ¶
type HxResponseHeader string
HxResponseHeader ...
const ( HXLocation HxResponseHeader = "HX-Location" // Allows you to do a client-side redirect that does not do a full page reload HXPushUrl HxResponseHeader = "HX-Push-Url" // pushes a new url into the history stack HXRedirect HxResponseHeader = "HX-Redirect" // can be used to do a client-side redirect to a new location HXRefresh HxResponseHeader = "HX-Refresh" // if set to "true" the client side will do a full refresh of the page HXReplaceUrl HxResponseHeader = "HX-Replace-Url" // replaces the current URL in the location bar HXReswap HxResponseHeader = "HX-Reswap" // Allows you to specify how the response will be swapped. See hx-swap for possible values HXRetarget HxResponseHeader = "HX-Retarget" // A CSS selector that updates the target of the content update to a different element on the page HXReselect HxResponseHeader = "HX-Reselect" // 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 HXTrigger HxResponseHeader = "HX-Trigger" // allows you to trigger client side events, see the documentation for more info HXTriggerAfterSettle HxResponseHeader = "HX-Trigger-After-Settle" // allows you to trigger client side events, see the documentation for more info HXTriggerAfterSwap HxResponseHeader = "HX-Trigger-After-Swap" // allows you to trigger client side events, see the documentation for more info )
func (HxResponseHeader) String ¶
func (h HxResponseHeader) String() string
String returns the header as a string.
type HxResponseHeaders ¶
type HxResponseHeaders struct {
// contains filtered or unexported fields
}
HxResponseHeaders ...
func (*HxResponseHeaders) Get ¶
func (h *HxResponseHeaders) Get(k HxResponseHeader) string
Get is a helper function to get a header.
func (*HxResponseHeaders) Set ¶
func (h *HxResponseHeaders) Set(k HxResponseHeader, val string)
Set is a helper function to set a header.
type HxSwapDirection ¶ added in v1.0.2
type HxSwapDirection string
HxSwapDirection ...
const ( HxSwapDirectionTop HxSwapDirection = "top" HxSwapDirectionBottom HxSwapDirection = "bottom" )
type HxSwapScrolling ¶ added in v1.0.2
type HxSwapScrolling struct {
// contains filtered or unexported fields
}
HxSwapScrolling ...
func (*HxSwapScrolling) String ¶ added in v1.0.2
func (s *HxSwapScrolling) String() string
String ...
type HxSwapScrollingMode ¶ added in v1.0.2
type HxSwapScrollingMode string
HxSwapScrollingMode ...
const ( HxSwapScrollingScroll HxSwapScrollingMode = "scroll" HxSwapScrollingShow HxSwapScrollingMode = "show" )
func (HxSwapScrollingMode) String ¶ added in v1.0.2
func (s HxSwapScrollingMode) String() string
String ...
type HxSwapTiming ¶ added in v1.0.2
type HxSwapTiming struct {
// contains filtered or unexported fields
}
HxSwapTiming ...
type HxSwapTimingMode ¶ added in v1.0.2
type HxSwapTimingMode string
HxSwapTimingMode ...
const ( HxTimingSwap HxSwapTimingMode = "swap" HxTimingSettle HxSwapTimingMode = "settle" )
func (HxSwapTimingMode) String ¶ added in v1.0.2
func (s HxSwapTimingMode) String() string
String ...
type Node ¶ added in v1.0.1
Node is a node in the HTML tree.
func Attribute ¶ added in v1.0.1
Attribute is a node that renders an HTML attribute.
Example (Bool) ¶
package main import ( "os" htmx "github.com/zeiss/fiber-htmx" ) func main() { _ = htmx.Attribute("disabled", htmx.AsStr(true)).Render(os.Stdout) }
Output: disabled="true"
Example (Name_value) ¶
package main import ( "os" htmx "github.com/zeiss/fiber-htmx" ) func main() { _ = htmx.Attribute("href", "/").Render(os.Stdout) }
Output: href="/"
func AutoComplete ¶ added in v1.0.1
AutoComplete sets the autocomplete attribute for form elements.
func AutoFocus ¶ added in v1.0.1
func AutoFocus() Node
AutoFocus sets the autofocus attribute for form elements.
func AutoPlay ¶ added in v1.0.1
func AutoPlay() Node
AutoPlay sets the autoplay attribute for media elements.
func BlockQuote ¶ added in v1.0.1
BlockQuote represents an HTML blockquote element.
func Checked ¶ added in v1.0.1
func Checked() Node
Checked sets the checked attribute for input elements.
func ClipRule ¶ added in v1.0.2
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 Controls ¶ added in v1.0.1
func Controls() Node
Controls sets the controls attribute for media elements.
func D ¶ added in v1.0.2
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 ¶ added in v1.0.1
DataAttribute sets the data-{name} attribute for elements.
func DataElement ¶ added in v1.0.1
DataElement represents an HTML data element.
func Disabled ¶ added in v1.0.1
func Disabled() Node
Disabled sets the disabled attribute for form elements.
func FigCaption ¶ added in v1.0.1
FigCaption represents an HTML figcaption element.
func Fill ¶ added in v1.0.2
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 ¶ added in v1.0.2
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 ¶ added in v1.0.1
FormAttribute sets the form attribute for elements.
func FormElement ¶ added in v1.0.1
FormElement represents an HTML form element.
func HTML5 ¶ added in v1.0.1
func HTML5(ctx Ctx, props HTML5Props, body ...Node) Node
HTML5 generates an HTML5 document based on the provided properties.
func HandlebarsTemplate ¶ added in v1.0.33
HandlebarsTemplate sets the handlebars-template attribute to specify the handlebars template for the response.
func HxConfirm ¶ added in v1.0.1
HxConfirm sets the hx-confirm attribute to display a confirmation message.
func HxDelete ¶ added in v1.0.1
HxDelete sets the hx-delete attribute to specify the URL for DELETE requests.
func HxDisable ¶ added in v1.0.1
func HxDisable() Node
HxDisable sets the hx-disable attribute to disable htmx functionality.
func HxDisabledElt ¶ added in v1.1.36
HxDisabledElt sets the hx-disable-elt attribute to disable the target element.
func HxEncoding ¶ added in v1.0.1
HxEncoding sets the hx-encoding attribute to specify the encoding type for form submission.
func HxExt ¶ added in v1.0.1
HxExt sets the hx-ext attribute to specify the file extension for file uploads.
func HxInclude ¶ added in v1.0.32
HxInclude sets the hx-include attribute to specify the target element for inclusion.
func HxIndicator ¶ added in v1.0.1
HxIndicator sets the hx-indicator attribute to specify the target element for showing an indicator.
func HxOn ¶ added in v1.0.1
HxOn sets the hx-put-{target} attribute to specify the JavaScript code to execute on a PUT request.
func HxPath ¶ added in v1.0.1
HxPath sets the hx-patch attribute to specify the URL for PATCH requests.
func HxPost ¶ added in v1.0.1
HxPost sets the hx-post attribute to specify the URL for POST requests.
func HxPushUrl ¶ added in v1.0.1
HxPushUrl sets the hx-push-url attribute to enable or disable URL pushing.
func HxSelect ¶ added in v1.0.1
HxSelect sets the hx-select attribute to specify the target element for selection.
func HxSelectOob ¶ added in v1.0.1
HxSelectOob sets the hx-select-oob attribute to specify the target element for out-of-band selection.
func HxSwap ¶ added in v1.0.1
HxSwap sets the hx-swap attribute to specify the target element for swapping.
func HxSwapOob ¶ added in v1.0.1
HxSwapOob sets the hx-swap-oob attribute to specify the target element for out-of-band swapping.
func HxTarget ¶ added in v1.0.1
HxTarget sets the hx-target attribute to specify the target element for the response.
func HxTrigger ¶ added in v1.0.1
HxTrigger sets the hx-trigger attribute to specify the target element for triggering an event.
func HxValidate ¶ added in v1.0.1
HxValidate sets the hx-validate attribute to enable or disable form validation.
func HyperScript ¶ added in v1.1.8
HyperScript sets the _ attribute to specify the hyperscript for the response.
func Multiple ¶ added in v1.0.1
func Multiple() Node
Multiple sets the multiple attribute for input elements.
func MustacheTemplate ¶ added in v1.0.33
MustacheTemplate sets the mustache-template attribute to specify the mustache template for the response.
func NunjucksTemplate ¶ added in v1.0.33
NunjucksTemplate sets the nunjucks-template attribute to specify the nunjucks template for the response.
func Path ¶ added in v1.0.2
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 ¶ added in v1.0.1
Placeholder sets the placeholder attribute for input elements.
func PlaysInline ¶ added in v1.0.1
func PlaysInline() Node
PlaysInline sets the playsinline attribute for media elements.
func ReadOnly ¶ added in v1.0.1
func ReadOnly() Node
ReadOnly sets the readonly attribute for form elements.
func Required ¶ added in v1.0.1
func Required() Node
Required sets the required attribute for form elements.
func SVG ¶ added in v1.0.1
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 Selected ¶ added in v1.0.1
func Selected() Node
Selected sets the selected attribute for option elements.
func Stroke ¶ added in v1.0.2
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 ¶ added in v1.0.2
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 ¶ added in v1.0.1
StyleAttribute sets the style attribute for elements.
func StyleElement ¶ added in v1.0.1
StyleElement represents an HTML style element.
func TitleAttribute ¶ added in v1.0.1
TitleAttribute sets the title attribute for elements.
func TitleElement ¶ added in v1.0.1
TitleElement represents an HTML title element.
func ViewBox ¶ added in v1.0.2
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 ¶ added in v1.0.33
XSLTTemplat sets the xslt-template attribute to specify the xslt template for the response.
type NodeFunc ¶ added in v1.0.1
NodeFunc is a function that renders a node.
func Element ¶ added in v1.0.1
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/zeiss/fiber-htmx" ) func main() { _ = htmx.Element("div").Render(os.Stdout) }
Output: <div></div>
type NodeTypeDescriptor ¶ added in v1.0.1
type NodeTypeDescriptor interface {
Type() NodeType
}
NodeTypeDescriptor is a node that has a type.
type RangeLoop ¶ added in v1.0.38
type RangeLoop interface { // Filter loops and filters the content. Filter(f func(int) bool) RangeLoop // Map loops and maps the content. Map(f func(int) Node) RangeLoop // Group returns the nodes as a group. Group() Node }
RangeLoop is a loop control structure.
type RenderOpt ¶ added in v1.1.43
type RenderOpt func(h *Htmx)
RenderOpt is helper function to configure the render.
func RenderStatusCode ¶ added in v1.1.43
RenderStatusCode is a helper function to set the status code.
type Swap ¶ added in v1.0.2
type Swap struct {
// contains filtered or unexported fields
}
Swap ...
func (*Swap) FocusScroll ¶ added in v1.0.2
FocusScroll ...
func (*Swap) IgnoreTitle ¶ added in v1.0.2
IgnoreTitle ...
func (*Swap) Scroll ¶ added in v1.0.2
func (s *Swap) Scroll(direction HxSwapDirection, target ...string) *Swap
Scroll ...
func (*Swap) ScrollBottom ¶ added in v1.0.2
ScrollBottom ...
func (*Swap) Settle ¶ added in v1.0.2
Settle modifies the amount of time that htmx will wait after receiving a response to settle the content
func (*Swap) Show ¶ added in v1.0.2
func (s *Swap) Show(direction HxSwapDirection, target ...string) *Swap
Show ...
func (*Swap) ShowBottom ¶ added in v1.0.2
ShowBottom ...
func (*Swap) Swap ¶ added in v1.0.2
Swap modifies the amount of time that htmx will wait after receiving a response to swap the content
func (*Swap) Transition ¶ added in v1.0.2
Transition ...
type UnimplementedContext ¶ added in v1.0.42
type UnimplementedContext struct{}
UnimplementedContext is a helper type for unimplemented contexts.
func (*UnimplementedContext) Path ¶ added in v1.0.43
func (u *UnimplementedContext) Path() string
Path is a helper function to get the path from the context.
func (*UnimplementedContext) Values ¶ added in v1.0.42
func (u *UnimplementedContext) Values(key any, value ...any) (val any)
Values is a helper function to get the values from the context.
func (*UnimplementedContext) ValuesBool ¶ added in v1.0.42
func (u *UnimplementedContext) ValuesBool(key any, value ...any) (val bool)
ValuesBool is a helper function to get the values as a bool from the context.
func (*UnimplementedContext) ValuesInt ¶ added in v1.0.42
func (u *UnimplementedContext) ValuesInt(key any, value ...any) (val int)
ValuesInt is a helper function to get the values as an int from the context.
func (*UnimplementedContext) ValuesString ¶ added in v1.0.42
func (u *UnimplementedContext) ValuesString(key any, value ...any) (val string)
ValuesString is a helper function to get the values as a string from the context.
type UnimplementedController ¶ added in v1.0.42
type UnimplementedController = DefaultController
UnimplementedController is not to be used anymore. Deprecated: Use DefaultController instead.