Documentation ¶
Index ¶
- type Direction
- type Option
- func FocusScroll(val bool) Option
- func IgnoreTitle() Option
- func Scroll(direction Direction) Option
- func ScrollTo(selector string, direction Direction) Option
- func SettleAfter(d time.Duration) Option
- func Show(direction Direction) Option
- func ShowNone() Option
- func ShowTo(selector string, direction Direction) Option
- func SwapAfter(d time.Duration) Option
- func Transition(val bool) Option
- type Style
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Direction ¶
type Direction string
Direction represents the possible scroll direction values for the show and scroll modifiers
type Option ¶
type Option func(*Style)
func FocusScroll ¶
func IgnoreTitle ¶
func IgnoreTitle() Option
func SettleAfter ¶
func Transition ¶
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style represents an HTMX swap style that can be used to instruct HTMX how to swap content.
For more information, see: https://htmx.org/attributes/hx-swap
func AfterBegin ¶
AfterBegin Inserts the response before the first child of the target element
func BeforeBegin ¶
BeforeBegin Inserts the response before the target element
func InnerHTML ¶
InnerHTML replaces the inner HTML of the target element
Example ¶
package main import ( "fmt" "time" "github.com/patrickward/hop/render/htmx/swap" ) func main() { // For simple swaps, use any of the style functions alone s1 := swap.InnerHTML() // For more complex swaps, use any of the style functions with the options pattern s2 := swap.AfterBegin( swap.Transition(true), swap.IgnoreTitle(), swap.SwapAfter(time.Second*2), ) fmt.Println(s1.String()) fmt.Println(s2.String()) }
Output: innerHTML afterbegin transition:true swap:2s ignoreTitle:true
func None ¶
None Instructs HTMX not to append content from the response. However, out of band swaps will still be processed.
Click to show internal directories.
Click to hide internal directories.