Documentation
¶
Overview ¶
Package hb provides HTMX integration for HTML builder HTMX is a modern library that allows AJAX requests directly from HTML See https://htmx.org for complete documentation
Index ¶
- Constants
- func TestTagOption(t *testing.T)
- func TestTagPRE(t *testing.T)
- func TestTagSelect(t *testing.T)
- type BorderLayout
- func (bl *BorderLayout) AddBottom(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddCenter(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddLeft(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddRight(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddTop(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
- func (bl *BorderLayout) SetHeightPercents(height int) *BorderLayout
- func (bl *BorderLayout) SetHeightPixels(height int) *BorderLayout
- func (bl *BorderLayout) SetWidthPercents(width int) *BorderLayout
- func (bl *BorderLayout) SetWidthPixels(width int) *BorderLayout
- func (bl *BorderLayout) ToHTML() string
- type HtmlWebpage
- func (w *HtmlWebpage) AddChild(child TagInterface) *HtmlWebpage
- func (w *HtmlWebpage) AddChildren(children []TagInterface) *HtmlWebpage
- func (w *HtmlWebpage) AddHTML(html string) *HtmlWebpage
- func (w *HtmlWebpage) AddMeta(meta TagInterface) *HtmlWebpage
- func (w *HtmlWebpage) AddScript(script string) *HtmlWebpage
- func (w *HtmlWebpage) AddScriptURL(scriptURL string) *HtmlWebpage
- func (w *HtmlWebpage) AddScriptURLs(scriptURLs []string) *HtmlWebpage
- func (w *HtmlWebpage) AddScripts(scripts []string) *HtmlWebpage
- func (w *HtmlWebpage) AddStyle(style string) *HtmlWebpage
- func (w *HtmlWebpage) AddStyleURL(styleURL string) *HtmlWebpage
- func (w *HtmlWebpage) AddStyleURLs(styleURLs []string) *HtmlWebpage
- func (w *HtmlWebpage) AddStyles(styles []string) *HtmlWebpage
- func (w *HtmlWebpage) Attr(key, value string) *HtmlWebpage
- func (w *HtmlWebpage) Attrs(attrs map[string]string) *HtmlWebpage
- func (w *HtmlWebpage) Body() *Tag
- func (w *HtmlWebpage) Child(child TagInterface) *HtmlWebpage
- func (w *HtmlWebpage) Children(children []TagInterface) *HtmlWebpage
- func (w *HtmlWebpage) HTML(html string) *HtmlWebpage
- func (w *HtmlWebpage) Head() *Tag
- func (w *HtmlWebpage) Meta(meta *Tag) *HtmlWebpage
- func (w *HtmlWebpage) Script(script string) *HtmlWebpage
- func (w *HtmlWebpage) ScriptURL(scriptURL string) *HtmlWebpage
- func (w *HtmlWebpage) ScriptURLs(scriptURLs []string) *HtmlWebpage
- func (w *HtmlWebpage) SetAttribute(key, value string) *HtmlWebpage
- func (w *HtmlWebpage) SetCharset(charset string) *HtmlWebpage
- func (w *HtmlWebpage) SetFavicon(favicon string) *HtmlWebpage
- func (w *HtmlWebpage) SetLanguage(language string) *HtmlWebpage
- func (w *HtmlWebpage) SetTitle(title string) *HtmlWebpage
- func (w *HtmlWebpage) Style(style string) *HtmlWebpage
- func (w *HtmlWebpage) StyleURL(styleURL string) *HtmlWebpage
- func (w *HtmlWebpage) StyleURLs(styleURLs []string) *HtmlWebpage
- func (w *HtmlWebpage) ToHTML() string
- type SwalOptions
- type SwapMethod
- type Tag
- func A(children ...TagInterface) *Tag
- func Abbr(children ...TagInterface) *Tag
- func Address(children ...TagInterface) *Tag
- func Article(children ...TagInterface) *Tag
- func Aside(children ...TagInterface) *Tag
- func B(children ...TagInterface) *Tag
- func BR() *Tag
- func Bold(children ...TagInterface) *Tag
- func Br() *Tag
- func Button(children ...TagInterface) *Tag
- func Canvas(children ...TagInterface) *Tag
- func Caption(children ...TagInterface) *Tag
- func Code(children ...TagInterface) *Tag
- func Dialog(children ...TagInterface) *Tag
- func Div(children ...TagInterface) *Tag
- func FieldSet(children ...TagInterface) *Tag
- func Footer(children ...TagInterface) *Tag
- func Form(children ...TagInterface) *Tag
- func H1(children ...TagInterface) *Tag
- func H2(children ...TagInterface) *Tag
- func H3(children ...TagInterface) *Tag
- func H4(children ...TagInterface) *Tag
- func H5(children ...TagInterface) *Tag
- func H6(children ...TagInterface) *Tag
- func HR() *Tag
- func Header(children ...TagInterface) *Tag
- func Heading1(children ...TagInterface) *Tag
- func Heading2(children ...TagInterface) *Tag
- func Heading3(children ...TagInterface) *Tag
- func Heading4(children ...TagInterface) *Tag
- func Heading5(children ...TagInterface) *Tag
- func Heading6(children ...TagInterface) *Tag
- func Hr() *Tag
- func Hyperlink(children ...TagInterface) *Tag
- func I(children ...TagInterface) *Tag
- func Iframe(src string) *Tag
- func Image(src string) *Tag
- func Img(src string) *Tag
- func Input() *Tag
- func LI(children ...TagInterface) *Tag
- func Label(children ...TagInterface) *Tag
- func Li(children ...TagInterface) *Tag
- func Link() *Tag
- func Main(children ...TagInterface) *Tag
- func Meta() *Tag
- func Nav(children ...TagInterface) *Tag
- func Navbar(children ...TagInterface) *Tag
- func NewA() *Tag
- func NewAbbr() *Tag
- func NewAddress() *Tag
- func NewArticle() *Tag
- func NewAside() *Tag
- func NewB() *Tag
- func NewBR() *Tag
- func NewBold() *Tag
- func NewButton() *Tag
- func NewCanvas() *Tag
- func NewCaption() *Tag
- func NewCode() *Tag
- func NewDialog() *Tag
- func NewDiv() *Tag
- func NewFieldSet() *Tag
- func NewFigure() *Tag
- func NewFooter() *Tag
- func NewForm() *Tag
- func NewH1() *Tag
- func NewH2() *Tag
- func NewH3() *Tag
- func NewH4() *Tag
- func NewH5() *Tag
- func NewH6() *Tag
- func NewHR() *Tag
- func NewHTML(html string) *Tag
- func NewHeader() *Tag
- func NewHeading1() *Tag
- func NewHeading2() *Tag
- func NewHeading3() *Tag
- func NewHeading4() *Tag
- func NewHeading5() *Tag
- func NewHeading6() *Tag
- func NewHyperlink() *Tag
- func NewI() *Tag
- func NewIframe() *Tag
- func NewImage() *Tag
- func NewImg() *Tag
- func NewInput() *Tag
- func NewLI() *Tag
- func NewLabel() *Tag
- func NewLink() *Tag
- func NewMain() *Tag
- func NewMeta() *Tag
- func NewNav() *Tag
- func NewNavbar() *Tag
- func NewOL() *Tag
- func NewOption() *Tag
- func NewP() *Tag
- func NewPRE() *Tag
- func NewParagraph() *Tag
- func NewPod() *Tag
- func NewRaw(html string) *Tag
- func NewScript(javascript string) *Tag
- func NewScriptURL(javascriptURL string) *Tag
- func NewSection() *Tag
- func NewSelect() *Tag
- func NewSmall() *Tag
- func NewSpan() *Tag
- func NewStrong() *Tag
- func NewStyle(css string) *Tag
- func NewStyleURL(styleURL string) *Tag
- func NewSub() *Tag
- func NewSup() *Tag
- func NewTD() *Tag
- func NewTH() *Tag
- func NewTR() *Tag
- func NewTable() *Tag
- func NewTag(tagName string) *Tag
- func NewTbody() *Tag
- func NewTemplate() *Tag
- func NewText(text string) *Tag
- func NewTextArea() *Tag
- func NewTfoot() *Tag
- func NewThead() *Tag
- func NewTitle() *Tag
- func NewUL() *Tag
- func NewVideo() *Tag
- func NewWrap() *Tag
- func OL(children ...TagInterface) *Tag
- func Ol(children ...TagInterface) *Tag
- func Option(children ...TagInterface) *Tag
- func P(children ...TagInterface) *Tag
- func PRE(children ...TagInterface) *Tag
- func Paragraph(children ...TagInterface) *Tag
- func Raw(html string) *Tag
- func Script(javascript string) *Tag
- func ScriptURL(javascriptURL string) *Tag
- func Section(children ...TagInterface) *Tag
- func Select(children ...TagInterface) *Tag
- func Small(children ...TagInterface) *Tag
- func Span(children ...TagInterface) *Tag
- func Strong(children ...TagInterface) *Tag
- func Style(css string) *Tag
- func StyleURL(styleURL string) *Tag
- func Sub(children ...TagInterface) *Tag
- func Sup(children ...TagInterface) *Tag
- func TBody(children ...TagInterface) *Tag
- func TD(children ...TagInterface) *Tag
- func TFoot(children ...TagInterface) *Tag
- func TH(children ...TagInterface) *Tag
- func THead(children ...TagInterface) *Tag
- func TR(children ...TagInterface) *Tag
- func Table(children ...TagInterface) *Tag
- func Tbody(children ...TagInterface) *Tag
- func Td(children ...TagInterface) *Tag
- func Template() *Tag
- func Text(text string) *Tag
- func TextArea() *Tag
- func Textarea() *Tag
- func Tfoot(children ...TagInterface) *Tag
- func Th(children ...TagInterface) *Tag
- func Thead(children ...TagInterface) *Tag
- func Title(children ...TagInterface) *Tag
- func Tr(children ...TagInterface) *Tag
- func UL(children ...TagInterface) *Tag
- func Ul(children ...TagInterface) *Tag
- func Wrap(children ...TagInterface) *Tag
- func (t *Tag) Action(action string) *Tag
- func (t *Tag) AddChild(child TagInterface) *Tag
- func (t *Tag) AddChildren(children []TagInterface) *Tag
- func (t *Tag) AddClass(className string) *Tag
- func (t *Tag) AddHTML(html string) *Tag
- func (t *Tag) AddStyle(style string) *Tag
- func (t *Tag) AddText(text string) *Tag
- func (t *Tag) Alt(text string) *Tag
- func (t *Tag) Aria(key, value string) *Tag
- func (t *Tag) Attr(key, value string) *Tag
- func (t *Tag) AttrIf(condition bool, key, value string) *Tag
- func (t *Tag) AttrIfElse(condition bool, key, valueIf, valueElse string) *Tag
- func (t *Tag) AttrIfF(condition bool, key string, valueFunc func() string) *Tag
- func (t *Tag) Attrs(attrs map[string]string) *Tag
- func (t *Tag) AttrsIf(condition bool, attrs map[string]string) *Tag
- func (t *Tag) AttrsIfElse(condition bool, attrsIf, attrsElse map[string]string) *Tag
- func (t *Tag) AttrsIfF(condition bool, attrsFunc func() map[string]string) *Tag
- func (t *Tag) Child(child TagInterface) *Tag
- func (t *Tag) ChildIf(condition bool, child TagInterface) *Tag
- func (t *Tag) ChildIfElse(condition bool, childIf, childElse TagInterface) *Tag
- func (t *Tag) ChildIfF(condition bool, childFunc func() TagInterface) *Tag
- func (t *Tag) Children(children []TagInterface) *Tag
- func (t *Tag) ChildrenIf(condition bool, children []TagInterface) *Tag
- func (t *Tag) ChildrenIfElse(condition bool, childrenIf, childrenElse []TagInterface) *Tag
- func (t *Tag) ChildrenIfF(condition bool, childrenFunc func() []TagInterface) *Tag
- func (t *Tag) Class(className string) *Tag
- func (t *Tag) ClassIf(condition bool, className string) *Tag
- func (t *Tag) ClassIfElse(condition bool, classNameIf, classNameElse string) *Tag
- func (t *Tag) ClassIfF(condition bool, classNameFunc func() string) *Tag
- func (t *Tag) Data(name, value string) *Tag
- func (t *Tag) DataIf(condition bool, name, value string) *Tag
- func (t *Tag) DataIfElse(condition bool, name, valueIf, valueElse string) *Tag
- func (t *Tag) Enctype(enctype string) *Tag
- func (t *Tag) For(forID string) *Tag
- func (t *Tag) GetAttribute(key string) string
- func (t *Tag) HTML(html string) *Tag
- func (t *Tag) HTMLIf(condition bool, html string) *Tag
- func (t *Tag) HTMLIfElse(condition bool, htmlIf, htmlElse string) *Tag
- func (t *Tag) HTMLIfF(condition bool, htmlFunc func() string) *Tag
- func (t *Tag) HasAttribute(key string) bool
- func (t *Tag) HasAttributeValue(key, value string) bool
- func (t *Tag) HasClass(className string) bool
- func (t *Tag) Href(href string) *Tag
- func (t *Tag) Hx(name, value string) *Tag
- func (t *Tag) HxConfirm(value string) *Tag
- func (t *Tag) HxDelete(value string) *Tag
- func (t *Tag) HxGet(value string) *Tag
- func (t *Tag) HxInclude(value string) *Tag
- func (t *Tag) HxIndicator(value string) *Tag
- func (t *Tag) HxOn(name, value string) *Tag
- func (t *Tag) HxPatch(value string) *Tag
- func (t *Tag) HxPost(value string) *Tag
- func (t *Tag) HxPut(value string) *Tag
- func (t *Tag) HxSelect(value string) *Tag
- func (t *Tag) HxSelectOob(value string) *Tag
- func (t *Tag) HxSwap(method SwapMethod) *Tag
- func (t *Tag) HxSwapOob(value string) *Tag
- func (t *Tag) HxSync(value string) *Tag
- func (t *Tag) HxTarget(value string) *Tag
- func (t *Tag) HxTrigger(value string) *Tag
- func (t *Tag) HxVals(value string) *Tag
- func (t *Tag) HxVars(value string) *Tag
- func (t *Tag) ID(id string) *Tag
- func (t *Tag) Method(method string) *Tag
- func (t *Tag) Name(name string) *Tag
- func (t *Tag) OnBlur(js string) *Tag
- func (t *Tag) OnChange(js string) *Tag
- func (t *Tag) OnClick(js string) *Tag
- func (t *Tag) OnDblClick(js string) *Tag
- func (t *Tag) OnFocus(js string) *Tag
- func (t *Tag) OnInput(js string) *Tag
- func (t *Tag) OnKeyDown(js string) *Tag
- func (t *Tag) OnKeyPress(js string) *Tag
- func (t *Tag) OnKeyUp(js string) *Tag
- func (t *Tag) OnLoad(js string) *Tag
- func (t *Tag) OnMouseDown(js string) *Tag
- func (t *Tag) OnMouseEnter(js string) *Tag
- func (t *Tag) OnMouseLeave(js string) *Tag
- func (t *Tag) OnMouseMove(js string) *Tag
- func (t *Tag) OnMouseOut(js string) *Tag
- func (t *Tag) OnMouseOver(js string) *Tag
- func (t *Tag) OnMouseUp(js string) *Tag
- func (t *Tag) OnSubmit(js string) *Tag
- func (t *Tag) Placeholder(placeholder string) *Tag
- func (t *Tag) ReadOnly(isReadOnly bool) *Tag
- func (t *Tag) Rel(rel string) *Tag
- func (t *Tag) RemoveAttribute(key string) *Tag
- func (t *Tag) Required(isRequired bool) *Tag
- func (t *Tag) Role(role string) *Tag
- func (t *Tag) Selected(isSelected bool) *Tag
- func (t *Tag) SetAttribute(key, value string) *Tag
- func (t *Tag) Src(src string) *Tag
- func (t *Tag) SrcIf(condition bool, src string) *Tag
- func (t *Tag) SrcIfElse(condition bool, srcIf, srcElse string) *Tag
- func (t *Tag) SrcIfF(condition bool, srcFunc func() string) *Tag
- func (t *Tag) Style(style string) *Tag
- func (t *Tag) StyleIf(condition bool, style string) *Tag
- func (t *Tag) StyleIfElse(condition bool, styleIf, styleElse string) *Tag
- func (t *Tag) StyleIfF(condition bool, styleFunc func() string) *Tag
- func (t *Tag) Target(target string) *Tag
- func (t *Tag) TargetIf(condition bool, target string) *Tag
- func (t *Tag) TargetIfElse(condition bool, targetIf, targetElse string) *Tag
- func (t *Tag) Text(text string) *Tag
- func (t *Tag) TextIf(condition bool, text string) *Tag
- func (t *Tag) TextIfElse(condition bool, textIf, textElse string) *Tag
- func (t *Tag) TextIfF(condition bool, textFunc func() string) *Tag
- func (t *Tag) Title(title string) *Tag
- func (t *Tag) TitleIf(condition bool, title string) *Tag
- func (t *Tag) TitleIfElse(condition bool, titleIf, titleElse string) *Tag
- func (t *Tag) ToHTML() string
- func (t *Tag) Type(inputType string) *Tag
- func (t *Tag) TypeIf(condition bool, inputType string) *Tag
- func (t *Tag) TypeIfElse(condition bool, typeIf, typeElse string) *Tag
- func (t *Tag) Value(value string) *Tag
- func (t *Tag) ValueIf(condition bool, value string) *Tag
- func (t *Tag) ValueIfElse(condition bool, valueIf, valueElse string) *Tag
- func (t *Tag) X(name, value string) *Tag
- func (t *Tag) XBind(name, value string) *Tag
- func (t *Tag) XOn(name, value string) *Tag
- type TagInterface
- func If(condition bool, trueTag TagInterface) TagInterface
- func IfElse(condition bool, trueTag, falseTag TagInterface) TagInterface
- func IfF(condition bool, trueFunc func() TagInterface) TagInterface
- func IfFElseF(condition bool, trueFunc, falseFunc func() TagInterface) TagInterface
- func NewSwal(options SwalOptions) TagInterface
- func NewSwalError(options SwalOptions) TagInterface
- func NewSwalInfo(options SwalOptions) TagInterface
- func NewSwalSuccess(options SwalOptions) TagInterface
- func NewSwalWarning(options SwalOptions) TagInterface
- func Swal(options SwalOptions) TagInterface
- func SwalError(options SwalOptions) TagInterface
- func SwalInfo(options SwalOptions) TagInterface
- func SwalSuccess(options SwalOptions) TagInterface
- func SwalWarning(options SwalOptions) TagInterface
- func Ternary(condition bool, trueTag, falseTag TagInterface) TagInterface
- func TernaryF(condition bool, trueFunc, falseFunc func() TagInterface) TagInterface
- func ToTags[T any](items []T, callback func(item T, index int) TagInterface) []TagInterface
Constants ¶
const BORDER_LAYOUT_ALIGN_BOTTOM = "bottom"
const BORDER_LAYOUT_ALIGN_CENTER = "center"
const BORDER_LAYOUT_ALIGN_LEFT = "left"
const BORDER_LAYOUT_ALIGN_MIDDLE = "middle"
const BORDER_LAYOUT_ALIGN_RIGHT = "right"
const BORDER_LAYOUT_ALIGN_TOP = "top"
const DEFAULT_FAVICON = "" /* 1561-byte string literal not displayed */
const ENCTYPE_FORM_MULTIPART = "multipart/form-data"
ENCTYPE_MULTIPART_FORM_DATA ("multipart/form-data") Necessary if the user will upload a file through the form
const ENCTYPE_FORM_TEXT = "text/plain"
ENCTYPE_FORM_TEXT ("text/plain") plain text An ambiguous format, human-readable content not reliably interpretable by computer
const ENCTYPE_FORM_URLENCODED = "application/x-www-form-urlencoded"
ENCTYPE_FORM_URLENCODED ("application/x-www-form-urlencoded") default encoding of forms. All characters are converted. Spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values)
const TYPE_BUTTON = "button"
const TYPE_CHECKBOX = "checkbox"
const TYPE_COLOR = "color"
const TYPE_DATE = "date"
const TYPE_DATETIME = "datetime-local"
const TYPE_EMAIL = "email"
const TYPE_FILE = "file"
const TYPE_HIDDEN = "hidden"
const TYPE_IMAGE = "image"
const TYPE_MONTH = "month"
const TYPE_NUMBER = "number"
const TYPE_PASSWORD = "password"
const TYPE_RADIO = "radio"
const TYPE_RANGE = "range"
const TYPE_RESET = "reset"
const TYPE_SEARCH = "search"
const TYPE_SUBMIT = "submit"
const TYPE_TEL = "tel"
const TYPE_TEXT = "text"
const TYPE_TIME = "time"
const TYPE_URL = "url"
const TYPE_WEEK = "week"
Variables ¶
This section is empty.
Functions ¶
func TestTagOption ¶
func TestTagPRE ¶
func TestTagSelect ¶
Types ¶
type BorderLayout ¶
type BorderLayout struct {
Tag
// contains filtered or unexported fields
}
* * The BorderLayout type is an advanced layout. * * It arranges its children in five regions: top, bottom, left, right, and center. * Each region may contain no more than one widget. * <code> * // Creating a new instance of BorderLayout * borderlayout = NewBorderLayout() * AddChild("HEADER", BORDER_LAYOUT_ALIGN_CENTER, BORDER_LAYOUT_ALIGN_MIDDLE); * AddChild("CONTENT", BORDER_LAYOUT_ALIGN_CENTER, BORDER_LAYOUT_ALIGN_MIDDLE); * AddChild("FOOTER", BORDER_LAYOUT_ALIGN_CENTER, BORDER_LAYOUT_ALIGN_MIDDLE); * AddChild("MENU", BORDER_LAYOUT_ALIGN_CENTER, BORDER_LAYOUT_ALIGN_MIDDLE); * AddChild("ADDS", BORDER_LAYOUT_ALIGN_CENTER, BORDER_LAYOUT_ALIGN_MIDDLE); * </code>
func NewBorderLayout ¶
func NewBorderLayout() *BorderLayout
func (*BorderLayout) AddBottom ¶
func (bl *BorderLayout) AddBottom(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
func (*BorderLayout) AddCenter ¶
func (bl *BorderLayout) AddCenter(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
func (*BorderLayout) AddLeft ¶
func (bl *BorderLayout) AddLeft(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
func (*BorderLayout) AddRight ¶
func (bl *BorderLayout) AddRight(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
func (*BorderLayout) AddTop ¶
func (bl *BorderLayout) AddTop(tag TagInterface, alignHorizontal, alignVertical string) *BorderLayout
func (*BorderLayout) SetHeightPercents ¶
func (bl *BorderLayout) SetHeightPercents(height int) *BorderLayout
func (*BorderLayout) SetHeightPixels ¶
func (bl *BorderLayout) SetHeightPixels(height int) *BorderLayout
func (*BorderLayout) SetWidthPercents ¶
func (bl *BorderLayout) SetWidthPercents(width int) *BorderLayout
func (*BorderLayout) SetWidthPixels ¶
func (bl *BorderLayout) SetWidthPixels(width int) *BorderLayout
func (*BorderLayout) ToHTML ¶
func (bl *BorderLayout) ToHTML() string
BorderLayout returns HTML representation of the layout
type HtmlWebpage ¶
type HtmlWebpage struct {
Tag
// contains filtered or unexported fields
}
Webpage represents a new web page
func NewWebpage ¶
func NewWebpage() *HtmlWebpage
NewWebpage returns a webpage instance Shortcut method exists: Webpage()
func Webpage ¶
func Webpage(children ...TagInterface) *HtmlWebpage
Webpage is a shortcut to create a new HTML page
func (*HtmlWebpage) AddChild ¶
func (w *HtmlWebpage) AddChild(child TagInterface) *HtmlWebpage
AddChild adds a tag to the webpage
func (*HtmlWebpage) AddChildren ¶
func (w *HtmlWebpage) AddChildren(children []TagInterface) *HtmlWebpage
AddChildren adds tags to the webpage
func (*HtmlWebpage) AddHTML ¶
func (w *HtmlWebpage) AddHTML(html string) *HtmlWebpage
AddHTML adds an HTML to the body of the webpage
func (*HtmlWebpage) AddMeta ¶
func (w *HtmlWebpage) AddMeta(meta TagInterface) *HtmlWebpage
func (*HtmlWebpage) AddScript ¶
func (w *HtmlWebpage) AddScript(script string) *HtmlWebpage
AddScript adds a script to the webpage
func (*HtmlWebpage) AddScriptURL ¶
func (w *HtmlWebpage) AddScriptURL(scriptURL string) *HtmlWebpage
AddScriptURL adds a style URL to the webpage
func (*HtmlWebpage) AddScriptURLs ¶
func (w *HtmlWebpage) AddScriptURLs(scriptURLs []string) *HtmlWebpage
AddScriptURLs adds style URLs to the webpage
func (*HtmlWebpage) AddScripts ¶
func (w *HtmlWebpage) AddScripts(scripts []string) *HtmlWebpage
AddScripts adds scripts to the webpage
func (*HtmlWebpage) AddStyle ¶
func (w *HtmlWebpage) AddStyle(style string) *HtmlWebpage
AddStyle adds a style to the webpage
func (*HtmlWebpage) AddStyleURL ¶
func (w *HtmlWebpage) AddStyleURL(styleURL string) *HtmlWebpage
AddStyleURL adds a style URL to the webpage
func (*HtmlWebpage) AddStyleURLs ¶
func (w *HtmlWebpage) AddStyleURLs(styleURLs []string) *HtmlWebpage
AddStyleURLs adds style URLs to the webpage
func (*HtmlWebpage) AddStyles ¶
func (w *HtmlWebpage) AddStyles(styles []string) *HtmlWebpage
AddStyles adds styles to the webpage
func (*HtmlWebpage) Attr ¶
func (w *HtmlWebpage) Attr(key, value string) *HtmlWebpage
Attr shortcut for SetAttribute
func (*HtmlWebpage) Attrs ¶
func (w *HtmlWebpage) Attrs(attrs map[string]string) *HtmlWebpage
Attrs shortcut for setting multiple attributes
func (*HtmlWebpage) Child ¶
func (w *HtmlWebpage) Child(child TagInterface) *HtmlWebpage
AddChild shortcut for AddChild
func (*HtmlWebpage) Children ¶
func (w *HtmlWebpage) Children(children []TagInterface) *HtmlWebpage
Children shortcut for AddChildren
func (*HtmlWebpage) HTML ¶
func (w *HtmlWebpage) HTML(html string) *HtmlWebpage
HTML shortcut for adding HTML to the body
func (*HtmlWebpage) Meta ¶
func (w *HtmlWebpage) Meta(meta *Tag) *HtmlWebpage
Meta shortcut for adding a meta
func (*HtmlWebpage) Script ¶
func (w *HtmlWebpage) Script(script string) *HtmlWebpage
Script shortcut for adding a script
func (*HtmlWebpage) ScriptURL ¶
func (w *HtmlWebpage) ScriptURL(scriptURL string) *HtmlWebpage
ScriptURL shortcut for adding a script URL
func (*HtmlWebpage) ScriptURLs ¶
func (w *HtmlWebpage) ScriptURLs(scriptURLs []string) *HtmlWebpage
ScriptURLs shortcut for adding script URLs
func (*HtmlWebpage) SetAttribute ¶
func (w *HtmlWebpage) SetAttribute(key, value string) *HtmlWebpage
SetAttribute adds a style to the webpage
func (*HtmlWebpage) SetCharset ¶
func (w *HtmlWebpage) SetCharset(charset string) *HtmlWebpage
SetCharset sets the charset of the webpage
func (*HtmlWebpage) SetFavicon ¶
func (w *HtmlWebpage) SetFavicon(favicon string) *HtmlWebpage
SetFavicon sets the favicon of the webpage
func (*HtmlWebpage) SetLanguage ¶
func (w *HtmlWebpage) SetLanguage(language string) *HtmlWebpage
SetLanguage sets the language of the webpage
func (*HtmlWebpage) SetTitle ¶
func (w *HtmlWebpage) SetTitle(title string) *HtmlWebpage
SetTitle sets the title of the webpage
func (*HtmlWebpage) Style ¶
func (w *HtmlWebpage) Style(style string) *HtmlWebpage
Style shortcut for adding a style
func (*HtmlWebpage) StyleURL ¶
func (w *HtmlWebpage) StyleURL(styleURL string) *HtmlWebpage
StyleURL shortcut for adding a style URL to the webpage
func (*HtmlWebpage) StyleURLs ¶
func (w *HtmlWebpage) StyleURLs(styleURLs []string) *HtmlWebpage
StyleURLs shortcut for adding style URLs to the webpage
func (*HtmlWebpage) ToHTML ¶
func (w *HtmlWebpage) ToHTML() string
ToHTML returns HTML representation of the webpage
type SwalOptions ¶
type SwalOptions struct {
Background string `json:"background,omitempty"`
Backdrop string `json:"backdrop,omitempty"`
CancelButtonColor string `json:"cancelButtonColor,omitempty"`
CancelButtonText string `json:"cancelButtonText,omitempty"`
Color string `json:"color,omitempty"`
ConfirmButtonText string `json:"confirmButtonText,omitempty"`
ConfirmButtonColor string `json:"confirmButtonColor,omitempty"`
ConfirmCallback string `json:"-"`
DenyButtonText string `json:"denyButtonText,omitempty"`
CustomClass string `json:"customClass,omitempty"`
Grow string `json:"grow,omitempty"`
HeightAuto bool `json:"heightAuto,omitempty"`
HTML string `json:"html,omitempty"`
Icon string `json:"icon,omitempty"`
IconColor string `json:"iconColor,omitempty"`
IconHtml string `json:"iconHtml,omitempty"`
ImageURL string `json:"imageUrl,omitempty"`
ImageWidth string `json:"imageWidth,omitempty"`
ImageHeight string `json:"imageHeight,omitempty"`
ImageAlt string `json:"imageAlt,omitempty"`
Padding string `json:"padding,omitempty"`
Position string `json:"position,omitempty"`
ShowCancelButton bool `json:"showCancelButton"`
ShowConfirmButton bool `json:"showConfirmButton"`
ShowDenyButton bool `json:"showDenyButton"`
Text string `json:"text,omitempty"`
TimerProgressBar bool `json:"timerProgressBar,omitempty"`
Title string `json:"title,omitempty"`
Timer int `json:"timer,omitempty"`
Toast bool `json:"toast,omitempty"`
Width string `json:"width,omitempty"`
// The following are not standard Sweetalert2 options, do not export to JSON
RedirectURL string `json:"-"`
RedirectSeconds int `json:"-"`
}
SwalOptions represents configuration options for SweetAlert2 dialogs See https://sweetalert2.github.io/ for full documentation
type SwapMethod ¶
type SwapMethod string
const ( SwapInnerHTML SwapMethod = "innerHTML" SwapOuterHTML SwapMethod = "outerHTML" SwapBeforeEnd SwapMethod = "beforeend" SwapAfterEnd SwapMethod = "afterend" SwapBeforeBegin SwapMethod = "beforebegin" SwapAfterBegin SwapMethod = "afterbegin" SwapNone SwapMethod = "none" )
type Tag ¶
type Tag struct {
TagName string
TagContent string
TagAttributes map[string]string
TagChildren []TagInterface
}
Tag represents an HTML tag https://developer.mozilla.org/en-US/docs/Web/HTML/Element
func Abbr ¶
func Abbr(children ...TagInterface) *Tag
func Address ¶
func Address(children ...TagInterface) *Tag
func Article ¶
func Article(children ...TagInterface) *Tag
func Aside ¶
func Aside(children ...TagInterface) *Tag
func Button ¶
func Button(children ...TagInterface) *Tag
Button is a shortcut to create a new BUTTON tag
func Canvas ¶
func Canvas(children ...TagInterface) *Tag
Canvas is a shortcut to create a new CANVAS tag
func Caption ¶
func Caption(children ...TagInterface) *Tag
Caption is a shortcut to create a new CAPTION tag
func Dialog ¶
func Dialog(children ...TagInterface) *Tag
func FieldSet ¶
func FieldSet(children ...TagInterface) *Tag
func Footer ¶
func Footer(children ...TagInterface) *Tag
Footer is a shortcut to create a new FOOTER tag
func Header ¶
func Header(children ...TagInterface) *Tag
Header is a shortcut to create a new HEADER tag
func Heading1 ¶
func Heading1(children ...TagInterface) *Tag
Heading1 is a shortcut to create a new H1 tag
func Heading2 ¶
func Heading2(children ...TagInterface) *Tag
Heading2 is a shortcut to create a new H2 tag
func Heading3 ¶
func Heading3(children ...TagInterface) *Tag
Heading3 is a shortcut to create a new H3 tag
func Heading4 ¶
func Heading4(children ...TagInterface) *Tag
Heading4 is a shortcut to create a new H4 tag
func Heading5 ¶
func Heading5(children ...TagInterface) *Tag
Heading5 is a shortcut to create a new H5 tag
func Heading6 ¶
func Heading6(children ...TagInterface) *Tag
Heading6 is a shortcut to create a new H6 tag
func Hyperlink ¶
func Hyperlink(children ...TagInterface) *Tag
Hyperlink is a shortcut to create a new A tag
func Label ¶
func Label(children ...TagInterface) *Tag
Label is a shortcut to create a new LABEL tag
func Navbar ¶
func Navbar(children ...TagInterface) *Tag
Navbar is a shortcut to create a new NAVBAR tag
func NewAddress ¶
func NewAddress() *Tag
NewAddress represents an ADDRESS tag Shortcut method exists: Address()
func NewArticle ¶
func NewArticle() *Tag
NewArticle represents an ARTICLE tag Shortcut method exists: Article()
func NewAside ¶
func NewAside() *Tag
NewAside represents an ASIDE tag Shortcut method exists: Aside()
func NewButton ¶
func NewButton() *Tag
NewButton represents a BUTTON tag Shortcut method exists: Button()
func NewCanvas ¶
func NewCanvas() *Tag
NewCanvas represents a CANVAS tag Shortcut method exists: Canvas()
func NewCaption ¶
func NewCaption() *Tag
NewCaption is a shortcut to create a new CAPTION tag Shortcut method exists: Caption()
func NewDialog ¶
func NewDialog() *Tag
NewDialog represents a DIALOG tag Shortcut method exists: Dialog()
func NewFieldSet ¶
func NewFieldSet() *Tag
NewFieldSet represents a FIELDSET tag Shortcut method exists: FieldSet()
func NewFigure ¶
func NewFigure() *Tag
NewFigure represents a FIGURE tag Shortcut method exists: Figure()
func NewFooter ¶
func NewFooter() *Tag
NewFooter is a shortcut to create a new FOOTER tag Shortcut method exists: Footer()
func NewHTML ¶
NewHTML creates pure HTML without surrounding tags for safe escaped outut use NewText() Shortcut method exists: Raw() Deprecated: replaced by the new method NewRaw()
func NewHeader ¶
func NewHeader() *Tag
NewHeader is a shortcut to create a new HEADER tag Deprecated: replaced by the new method Header()
func NewHeading1 ¶
func NewHeading1() *Tag
NewHeading1 represents a H1 tag Shortcut method exists: Heading1()
func NewHeading2 ¶
func NewHeading2() *Tag
NewHeading2 represents a H2 tag Shortcut method exists: Heading2()
func NewHeading3 ¶
func NewHeading3() *Tag
NewHeading3 represents a H3 tag Shortcut method exists: Heading3()
func NewHeading4 ¶
func NewHeading4() *Tag
NewHeading4 represents a H4 tag Shortcut method exists: Heading4()
func NewHeading5 ¶
func NewHeading5() *Tag
NewHeading5 represents a H5 tag Shortcut method exists: Heading5()
func NewHeading6 ¶
func NewHeading6() *Tag
NewHeading6 represents a H6 tag Shortcut method exists: Heading6()
func NewHyperlink ¶
func NewHyperlink() *Tag
NewHyperlink represents a H1 tag Shortcut method exists: Hyperlink()
func NewIframe ¶
func NewIframe() *Tag
NewIframe represents an IFRAME tag Shortcut method exists: Iframe()
func NewLabel ¶
func NewLabel() *Tag
NewLabel represents a LABEL tag Shortcut method exists: Label()
func NewNavbar ¶
func NewNavbar() *Tag
NewNavbar represents a NAVBAR tag Deprecated: replaced by the new method Navbar()
func NewOption ¶
func NewOption() *Tag
NewOption represents an OPTION tag Shortcut method exists: Option()
func NewParagraph ¶
func NewParagraph() *Tag
NewParagraph represents a IMG tag Shortcut method exists: Paragraph()
func NewPod ¶
func NewPod() *Tag
NewPod represents a wrapper tag It serves as a container for other tags, and is used to wrap other tags together. Deprecated: replaced by the new method Wrap()
func NewRaw ¶
NewRaw creates pure escaped HTML without surrounding tags for safe escaped outut use NewText() Shortcut method exists: Raw()
func NewScriptURL ¶
NewScriptURL represents a SCRIPT tag with URL Shortcut method exists: ScriptURL()
func NewSection ¶
func NewSection() *Tag
NewSection represents a SECTION tag Shortcut method exists: Section()
func NewSelect ¶
func NewSelect() *Tag
NewSelect represents a SELECT tag Shortcut method exists: Select()
func NewSmall ¶
func NewSmall() *Tag
NewSmall represents a SMALL tag Shortcut method exists: Small()
func NewStrong ¶
func NewStrong() *Tag
NewStrong represents a STRONG tag Shortcut method exists: Strong()
func NewStyleURL ¶
NewStyleURL represents a LINK tag with URL Shortcut method exists: StyleURL()
func NewTable ¶
func NewTable() *Tag
NewTable represents a TABLE tag Shortcut method exists: Table()
func NewTag ¶
NewTag creates a tag, with the specified name useful for custom tags or ones that are not yet added to the hb library
func NewTbody ¶
func NewTbody() *Tag
NewTbody represents a TBODY tag Shortcut method exists: Tbody()
func NewTemplate ¶
func NewTemplate() *Tag
NewTemplate represents a TEMPLATE tag Shortcut method exists: Template()
func NewText ¶
NewText creates pure escaped text without surrounding tags Shortcut method exists: Text()
func NewTextArea ¶
func NewTextArea() *Tag
NewTextArea represents a FORM tag Shortcut method exists: TextArea()
func NewTfoot ¶
func NewTfoot() *Tag
NewTfoot represents a TFOOT tag Shortcut method exists: Tfoot()
func NewThead ¶
func NewThead() *Tag
NewThead represents a THEAD tag Shortcut method exists: Thead()
func NewTitle ¶
func NewTitle() *Tag
NewTitle represents a TITLE tag Shortcut method exists: Title()
func NewVideo ¶
func NewVideo() *Tag
NewVideo represents a VIDEO tag Shortcut method exists: Video()
func NewWrap ¶
func NewWrap() *Tag
NewWrap is a convenience tagless container to wrap multiple elements together. Any attributes added to the wrap tag will be lost. If you need to keep these better use a DIV tag Shortcut method exists: Wrap()
func Option ¶
func Option(children ...TagInterface) *Tag
Option is a shortcut to create a new OPTION tag
func Paragraph ¶
func Paragraph(children ...TagInterface) *Tag
Paragraph is a shortcut to create a new P tag
func Section ¶
func Section(children ...TagInterface) *Tag
Section is a shortcut to create a new SECTION tag
func Select ¶
func Select(children ...TagInterface) *Tag
Select is a shortcut to create a new SELECT tag
func Small ¶
func Small(children ...TagInterface) *Tag
Small is a shortcut to create a new SMALL tag
func Strong ¶
func Strong(children ...TagInterface) *Tag
Strong is a shortcut to create a new STRONG tag
func TBody ¶
func TBody(children ...TagInterface) *Tag
TBody is an alternative capitalization alias for Tbody
func TFoot ¶
func TFoot(children ...TagInterface) *Tag
TFoot is an alternative capitalization alias for Tfoot
func THead ¶
func THead(children ...TagInterface) *Tag
THead is an alternative capitalization alias for Thead
func Table ¶
func Table(children ...TagInterface) *Tag
Table is a shortcut to create a new TABLE tag
func Tbody ¶
func Tbody(children ...TagInterface) *Tag
Tbody is a shortcut to create a new TBODY tag
func Tfoot ¶
func Tfoot(children ...TagInterface) *Tag
Tfoot is a shortcut to create a new TFOOT tag
func Thead ¶
func Thead(children ...TagInterface) *Tag
Thead is a shortcut to create a new THEAD tag
func Title ¶
func Title(children ...TagInterface) *Tag
Title is a shortcut to create a new title tag
func Wrap ¶
func Wrap(children ...TagInterface) *Tag
Wrap is a convenience tagless container to wrap multiple elements together. Any attributes added to the wrap tag will be lost. If you need to keep these better use a DIV tag
func (*Tag) AddChild ¶
func (t *Tag) AddChild(child TagInterface) *Tag
AddChild adds a new child tag to this tag
func (*Tag) AddChildren ¶
func (t *Tag) AddChildren(children []TagInterface) *Tag
AddChildren adds an array of child tags to this tag
func (*Tag) AttrIfElse ¶
AttrIfElse shortcut for setting an attribute if a condition is met, otherwise adds another attribute
func (*Tag) AttrsIfElse ¶
AttrsIfElse shortcut for setting multiple attributes if a condition is met, otherwise adds another attribute
func (*Tag) AttrsIfF ¶
AttrsIfF shortcut for setting multiple attributes via function if a condition is met
func (*Tag) ChildIf ¶
func (t *Tag) ChildIf(condition bool, child TagInterface) *Tag
ChildIf adds a child if a condition is met
func (*Tag) ChildIfElse ¶
func (t *Tag) ChildIfElse(condition bool, childIf, childElse TagInterface) *Tag
ChildIfElse adds a child if a condition is met, otherwise adds another child
func (*Tag) ChildIfF ¶
func (t *Tag) ChildIfF(condition bool, childFunc func() TagInterface) *Tag
ChildIfF adds a child using function if a condition is met
func (*Tag) Children ¶
func (t *Tag) Children(children []TagInterface) *Tag
Children shortcut for AddChildren
func (*Tag) ChildrenIf ¶
func (t *Tag) ChildrenIf(condition bool, children []TagInterface) *Tag
ChildrenIf adds children if a condition is met
func (*Tag) ChildrenIfElse ¶
func (t *Tag) ChildrenIfElse(condition bool, childrenIf, childrenElse []TagInterface) *Tag
ChildrenIfElse adds children if a condition is met
func (*Tag) ChildrenIfF ¶
func (t *Tag) ChildrenIfF(condition bool, childrenFunc func() []TagInterface) *Tag
ChildrenIfF adds children using function if a condition is met
func (*Tag) ClassIfElse ¶
ClassIfElse adds class name if a condition is met
func (*Tag) DataIfElse ¶
DataIfElse shortcut for setting a "data-" attribute if a condition is met
func (*Tag) For ¶
For shortcut for setting the "for" attribute It is only applicable to the <label> element The value of the for attribute must be a single id for a labelable form-related element in the same document as the <label> element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label
func (*Tag) GetAttribute ¶
GetAttribute returns the value of an attribute
func (*Tag) HTMLIfElse ¶
HTMLIfElse adds HTML if a condition is met
func (*Tag) HasAttribute ¶
HasAttribute returns true if the tag has an attribute with the specified key.
func (*Tag) HasAttributeValue ¶
HasAttributeValue returns true if the tag has an attribute with the specified value.
func (*Tag) Hx ¶
Hx is a generic method for setting any HTMX attribute Attributes follow the format hx-{NAME}="{VALUE}" Returns the tag for method chaining
func (*Tag) HxConfirm ¶
HxConfirm sets the hx-confirm attribute for confirmation dialogs Returns the tag for method chaining
func (*Tag) HxDelete ¶
HxDelete sets the hx-delete attribute for AJAX DELETE requests Returns the tag for method chaining
func (*Tag) HxGet ¶
HxGet sets the hx-get attribute for AJAX GET requests Returns the tag for method chaining
func (*Tag) HxInclude ¶
HxInclude sets the hx-include attribute for element inclusion Returns the tag for method chaining
func (*Tag) HxIndicator ¶
HxIndicator sets the hx-indicator attribute for loading indicators Returns the tag for method chaining
func (*Tag) HxOn ¶
HxOn sets event handlers using the hx-on:{event} attribute Returns the tag for method chaining
func (*Tag) HxPatch ¶
HxPatch sets the hx-patch attribute for AJAX PATCH requests Returns the tag for method chaining
func (*Tag) HxPost ¶
HxPost sets the hx-post attribute for AJAX POST requests Returns the tag for method chaining
func (*Tag) HxPut ¶
HxPut sets the hx-put attribute for AJAX PUT requests Returns the tag for method chaining
func (*Tag) HxSelect ¶
HxSelect sets the hx-select attribute for element selection Returns the tag for method chaining
func (*Tag) HxSelectOob ¶
HxSelectOob sets the hx-select-oob attribute for out-of-band selection Returns the tag for method chaining
func (*Tag) HxSwap ¶
func (t *Tag) HxSwap(method SwapMethod) *Tag
HxSwap sets the hx-swap attribute for content swapping Returns the tag for method chaining
func (*Tag) HxSwapOob ¶
HxSwapOob sets the hx-swap-oob attribute for out-of-band swaps Returns the tag for method chaining
func (*Tag) HxSync ¶
HxSync sets the hx-sync attribute for request synchronization Returns the tag for method chaining
func (*Tag) HxTarget ¶
HxTarget sets the hx-target attribute for request targeting Returns the tag for method chaining
func (*Tag) HxTrigger ¶
HxTrigger sets the hx-trigger attribute for event triggering Returns the tag for method chaining
func (*Tag) HxVals ¶
HxVals sets the hx-vals attribute for request values Returns the tag for method chaining
func (*Tag) HxVars ¶
HxVars sets the hx-vars attribute for request variables Returns the tag for method chaining
func (*Tag) OnDblClick ¶
OnDblClick shortcut for setting the "ondblclick" attribute
func (*Tag) OnKeyPress ¶
OnKeyPress shortcut for setting the "onkeypress" attribute
func (*Tag) OnMouseDown ¶
OnMouseDown shortcut for setting the "onmousedown" attribute
func (*Tag) OnMouseEnter ¶
OnMouseEnter shortcut for setting the "onmouseenter" attribute
func (*Tag) OnMouseLeave ¶
OnMouseLeave shortcut for setting the "onmouseleave" attribute
func (*Tag) OnMouseMove ¶
OnMouseMove shortcut for setting the "onmousemove" attribute
func (*Tag) OnMouseOut ¶
OnMouseOut shortcut for setting the "onmouseout" attribute
func (*Tag) OnMouseOver ¶
OnMouseOver shortcut for setting the "onmouseover" attribute
func (*Tag) Placeholder ¶
Placeholder shortcut for setting the "placeholder" attribute
func (*Tag) ReadOnly ¶
ReadOnly shortcut for setting the "readonly" attribute The readonly attribute is supported by text, search, url, tel, email, password, date, month, week, time, datetime-local, and number <input> types and the <textarea> form control elements. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
func (*Tag) Rel ¶
Rel shortcut for setting the "rel" attribute The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>. https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
func (*Tag) RemoveAttribute ¶
RemoveAttribute removes an attribute
func (*Tag) Required ¶
Required shortcut for setting the "required" attribute The required attribute is supported by text, search, url, tel, email, password, date, month, week, time, datetime-local, number, checkbox, radio, file, <input> types along with the <select> and <textarea> form control elements. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
func (*Tag) Role ¶
Role shortcut for setting the "role" attribute https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA
func (*Tag) Selected ¶
Selected shortcut for setting the "selected" attribute Only applies to the <option> element in a <select>, <optgroup>, or <datalist>. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option
func (*Tag) SetAttribute ¶
SetAttribute sets the value of an attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
func (*Tag) StyleIfElse ¶
StyleIfElse adds style if a condition is met
func (*Tag) TargetIfElse ¶
TargetIfElse sets the "target" attribute based on a condition
func (*Tag) TextIfElse ¶
TextIfElse adds escaped text if a condition is met
func (*Tag) TitleIfElse ¶
TitleIfElse sets the "title" attribute based on a condition
func (*Tag) TypeIfElse ¶
TypeIfElse sets the "type" attribute based on a condition
func (*Tag) ValueIfElse ¶
ValueIfElse sets the "value" attribute based on a condition
type TagInterface ¶
type TagInterface interface {
ToHTML() string
}
TagInterface represents an HTML tag interface
func If ¶
func If(condition bool, trueTag TagInterface) TagInterface
func IfElse ¶
func IfElse(condition bool, trueTag, falseTag TagInterface) TagInterface
func IfF ¶
func IfF(condition bool, trueFunc func() TagInterface) TagInterface
func IfFElseF ¶
func IfFElseF(condition bool, trueFunc, falseFunc func() TagInterface) TagInterface
func NewSwal ¶
func NewSwal(options SwalOptions) TagInterface
NewSwal generates a script with a Sweetalert2 dialog Note! you must include the library yourself (i.e. CDN) Shortcut method exists: Swal()
func NewSwalError ¶
func NewSwalError(options SwalOptions) TagInterface
NewSwalError creates a SweetAlert2 error dialog with the provided options
func NewSwalInfo ¶
func NewSwalInfo(options SwalOptions) TagInterface
NewSwalInfo creates a SweetAlert2 info dialog with the provided options
func NewSwalSuccess ¶
func NewSwalSuccess(options SwalOptions) TagInterface
NewSwalSuccess creates a SweetAlert2 success dialog with the provided options
func NewSwalWarning ¶
func NewSwalWarning(options SwalOptions) TagInterface
NewSwalWarning creates a SweetAlert2 warning dialog with the provided options
func Swal ¶
func Swal(options SwalOptions) TagInterface
Swal generates a script with a SweetAlert2 dialog Note! you must include the library yourself (i.e. CDN)
func SwalError ¶
func SwalError(options SwalOptions) TagInterface
SwalError creates a SweetAlert2 error dialog
func SwalInfo ¶
func SwalInfo(options SwalOptions) TagInterface
SwalInfo creates a SweetAlert2 info dialog
func SwalSuccess ¶
func SwalSuccess(options SwalOptions) TagInterface
SwalSuccess creates a SweetAlert2 success dialog
func SwalWarning ¶
func SwalWarning(options SwalOptions) TagInterface
SwalWarning creates a SweetAlert2 warning dialog
func Ternary ¶
func Ternary(condition bool, trueTag, falseTag TagInterface) TagInterface
Ternary is a 1 line if/else statement.
func TernaryF ¶
func TernaryF(condition bool, trueFunc, falseFunc func() TagInterface) TagInterface
TernaryF is a 1 liner if/else statement whose options are functions
func ToTags ¶
func ToTags[T any](items []T, callback func(item T, index int) TagInterface) []TagInterface
ToTags is a functional helper to convert a slice of items to a slice of tags using a callback function
Example:
items := []string{"one", "two", "three"}
tags := ToTags(items, func(item string, index int) TagInterface {
return NewSpan().Text(item)
})
Output: <span>one</span><span>two</span><span>three</span>
Parameters: - items: The slice of items to convert to tags - callback: A function that takes an item and index and returns a TagInterface
Returns: - []TagInterface: A slice of tags