Documentation ¶
Index ¶
- Constants
- type BorderLayout
- func (bl *BorderLayout) AddBottom(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddCenter(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddLeft(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddRight(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
- func (bl *BorderLayout) AddTop(tag *Tag, alignHorizontal string, 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 SwalOptions
- type Tag
- func If(condition bool, trueTag *Tag) *Tag
- func IfElse(condition bool, trueTag *Tag, falseTag *Tag) *Tag
- func IfF(condition bool, trueFunc func() *Tag) *Tag
- func IfFElseF(condition bool, trueFunc func() *Tag, falseFunc func() *Tag) *Tag
- func Map[T any](items []T, callback func(item T, index int) *Tag) []*Tag
- func NewBR() *Tag
- func NewButton() *Tag
- func NewCaption() *Tag
- func NewCode() *Tag
- func NewDiv() *Tag
- func NewFooter() *Tag
- func NewForm() *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 NewImage() *Tag
- func NewInput() *Tag
- func NewLI() *Tag
- func NewLabel() *Tag
- func NewLink() *Tag
- func NewMeta() *Tag
- func NewNav() *Tag
- func NewNavbar() *Tag
- func NewOL() *Tag
- func NewOption() *Tag
- func NewPRE() *Tag
- func NewParagraph() *Tag
- func NewPod() *Tag
- func NewScript(javascript string) *Tag
- func NewScriptURL(javascriptURL string) *Tag
- func NewSection() *Tag
- func NewSelect() *Tag
- func NewSpan() *Tag
- func NewStyle(css string) *Tag
- func NewStyleURL(styleURL string) *Tag
- func NewSub() *Tag
- func NewSup() *Tag
- func NewSwal(options SwalOptions) *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 NewThead() *Tag
- func NewUL() *Tag
- func NewWrap() *Tag
- func Ternary(condition bool, trueTag *Tag, falseTag *Tag) *Tag
- func TernaryF(condition bool, trueFunc func() *Tag, falseFunc func() *Tag) *Tag
- func (t *Tag) Action(action string) *Tag
- func (t *Tag) AddChild(child *Tag) *Tag
- func (t *Tag) AddChildren(children []*Tag) *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) Attr(key, value string) *Tag
- func (t *Tag) AttrIf(condition bool, key, value string) *Tag
- func (t *Tag) AttrIfElse(condition bool, key, valueIf string, 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 map[string]string, attrsElse map[string]string) *Tag
- func (t *Tag) AttrsIfF(condition bool, attrsFunc func() map[string]string) *Tag
- func (t *Tag) Child(child *Tag) *Tag
- func (t *Tag) ChildIf(condition bool, child *Tag) *Tag
- func (t *Tag) ChildIfElse(condition bool, childIf *Tag, childElse *Tag) *Tag
- func (t *Tag) ChildIfF(condition bool, childFunc func() *Tag) *Tag
- func (t *Tag) Children(children []*Tag) *Tag
- func (t *Tag) ChildrenIf(condition bool, children []*Tag) *Tag
- func (t *Tag) ChildrenIfElse(condition bool, childrenIf []*Tag, childrenElse []*Tag) *Tag
- func (t *Tag) ChildrenIfF(condition bool, childrenFunc func() []*Tag) *Tag
- func (t *Tag) ChildrenMap(items []any, callback func(item any, index int) *Tag) *Tag
- func (t *Tag) Class(className string) *Tag
- func (t *Tag) ClassIf(condition bool, className string) *Tag
- func (t *Tag) ClassIfElse(condition bool, classNameIf string, classNameElse string) *Tag
- func (t *Tag) Data(name string, value string) *Tag
- func (t *Tag) DataIf(condition bool, name string, value string) *Tag
- func (t *Tag) DataIfElse(condition bool, name string, valueIf string, valueElse string) *Tag
- func (t *Tag) Enctype(enctype 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 string, htmlElse string) *Tag
- func (t *Tag) HasClass(className string) bool
- func (t *Tag) Href(href string) *Tag
- func (t *Tag) Hx(name string, 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) HxOn(name string, 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(value string) *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) Role(role string) *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) Style(style string) *Tag
- func (t *Tag) StyleIf(condition bool, style string) *Tag
- func (t *Tag) StyleIfElse(condition bool, styleIf string, styleElse string) *Tag
- func (t *Tag) Target(target string) *Tag
- func (t *Tag) TargetIf(condition bool, target 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 string, textElse string) *Tag
- func (t *Tag) Title(title string) *Tag
- func (t *Tag) TitleIf(condition bool, title 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) Value(value string) *Tag
- func (t *Tag) ValueIf(condition bool, value string) *Tag
- func (t *Tag) X(name string, value string) *Tag
- func (t *Tag) XBind(name string, value string) *Tag
- func (t *Tag) XOn(name string, value string) *Tag
- type TagInterface
- type Webpage
- func (w *Webpage) AddChild(child *Tag) *Webpage
- func (w *Webpage) AddChildren(children []*Tag) *Webpage
- func (w *Webpage) AddHTML(html string) *Webpage
- func (w *Webpage) AddMeta(meta *Tag) *Webpage
- func (w *Webpage) AddScript(script string) *Webpage
- func (w *Webpage) AddScriptURL(scriptURL string) *Webpage
- func (w *Webpage) AddScriptURLs(scriptURLs []string) *Webpage
- func (w *Webpage) AddScripts(scripts []string) *Webpage
- func (w *Webpage) AddStyle(style string) *Webpage
- func (w *Webpage) AddStyleURL(styleURL string) *Webpage
- func (w *Webpage) AddStyleURLs(styleURLs []string) *Webpage
- func (w *Webpage) AddStyles(styles []string) *Webpage
- func (w *Webpage) Attr(key, value string) *Webpage
- func (w *Webpage) Attrs(attrs map[string]string) *Webpage
- func (w *Webpage) Body() *Tag
- func (w *Webpage) Child(child *Tag) *Webpage
- func (w *Webpage) Children(children []*Tag) *Webpage
- func (w *Webpage) HTML(html string) *Webpage
- func (w *Webpage) Head() *Tag
- func (w *Webpage) Meta(meta *Tag) *Webpage
- func (w *Webpage) Script(script string) *Webpage
- func (w *Webpage) ScriptURL(scriptURL string) *Webpage
- func (w *Webpage) ScriptURLs(scriptURLs []string) *Webpage
- func (w *Webpage) SetAttribute(key string, value string) *Webpage
- func (w *Webpage) SetCharset(charset string) *Webpage
- func (w *Webpage) SetFavicon(favicon string) *Webpage
- func (w *Webpage) SetLanguage(language string) *Webpage
- func (w *Webpage) SetTitle(title string) *Webpage
- func (w *Webpage) Style(style string) *Webpage
- func (w *Webpage) StyleURL(styleURL string) *Webpage
- func (w *Webpage) StyleURLs(styleURLs []string) *Webpage
- func (w *Webpage) ToHTML() string
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 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 ¶
This section is empty.
Types ¶
type BorderLayout ¶ added in v1.37.0
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 ¶ added in v1.37.0
func NewBorderLayout() *BorderLayout
func (*BorderLayout) AddBottom ¶ added in v1.37.0
func (bl *BorderLayout) AddBottom(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
func (*BorderLayout) AddCenter ¶ added in v1.37.0
func (bl *BorderLayout) AddCenter(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
func (*BorderLayout) AddLeft ¶ added in v1.37.0
func (bl *BorderLayout) AddLeft(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
func (*BorderLayout) AddRight ¶ added in v1.37.0
func (bl *BorderLayout) AddRight(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
func (*BorderLayout) AddTop ¶ added in v1.37.0
func (bl *BorderLayout) AddTop(tag *Tag, alignHorizontal string, alignVertical string) *BorderLayout
func (*BorderLayout) SetHeightPercents ¶ added in v1.37.0
func (bl *BorderLayout) SetHeightPercents(height int) *BorderLayout
func (*BorderLayout) SetHeightPixels ¶ added in v1.37.0
func (bl *BorderLayout) SetHeightPixels(height int) *BorderLayout
func (*BorderLayout) SetWidthPercents ¶ added in v1.37.0
func (bl *BorderLayout) SetWidthPercents(width int) *BorderLayout
func (*BorderLayout) SetWidthPixels ¶ added in v1.37.0
func (bl *BorderLayout) SetWidthPixels(width int) *BorderLayout
func (*BorderLayout) ToHTML ¶ added in v1.37.0
func (bl *BorderLayout) ToHTML() string
BorderLayout returns HTML representation of the layout
type SwalOptions ¶ added in v1.68.0
type SwalOptions struct { Icon string `json:"icon,omitempty"` Text string `json:"text,omitempty"` Title string `json:"title,omitempty"` ShowCancelButton bool `json:"showCancelButton,omitempty"` CancelButtonColor string `json:"cancelButtonColor,omitempty"` CancelButtonText string `json:"cancelButtonText,omitempty"` ConfirmButtonText string `json:"confirmButtonText,omitempty"` ConfirmButtonColor string `json:"confirmButtonColor,omitempty"` ConfirmCallback string `json:"-"` }
type Tag ¶
type Tag struct { TagInterface TagName string TagContent string TagAttributes map[string]string TagChildren []*Tag }
Tag represents an HTML tag
func NewCaption ¶ added in v1.64.0
func NewCaption() *Tag
NewCaption is a shortcut to create a new CAPTION tag
func NewFooter ¶ added in v1.46.0
func NewFooter() *Tag
NewFooter is a shortcut to create a new FOOTER tag
func NewHeader ¶ added in v1.58.0
func NewHeader() *Tag
NewHeader is a shortcut to create a new HEADER tag
func NewPod ¶ added in v1.53.2
func NewPod() *Tag
NewPod represents a wrapper tag It serves as a container for other tags, and is used to wrap other tags together.
func NewScriptURL ¶
NewScriptURL represents a SCRIPT tag with URL
func NewStyleURL ¶
NewStyleURL represents a LINK tag with URL
func NewSwal ¶ added in v1.68.0
func NewSwal(options SwalOptions) *Tag
NewSwal generates a script with a Sweetalert2 dialog Note! you must include the library yourself (i.e. CDN)
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 NewWrap ¶ added in v1.56.0
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
func (*Tag) AddChildren ¶
AddChildren adds an array of child tags to this tag
func (*Tag) AddText ¶ added in v1.69.0
AddText adds an escaped text string as a child tag to this tag
func (*Tag) AttrIf ¶ added in v1.54.0
AttrIf shortcut for setting an attribute if a condition is met
func (*Tag) AttrIfElse ¶ added in v1.54.0
AttrIfElse shortcut for setting an attribute if a condition is met, otherwise adds another attribute
func (*Tag) AttrsIf ¶ added in v1.54.0
AttrsIf shortcut for setting multiple attributes if a condition is met
func (*Tag) AttrsIfElse ¶ added in v1.54.0
func (t *Tag) AttrsIfElse(condition bool, attrsIf map[string]string, attrsElse map[string]string) *Tag
AttrsIfElse shortcut for setting multiple attributes if a condition is met, otherwise adds another attribute
func (*Tag) AttrsIfF ¶ added in v1.57.0
AttrsIf shortcut for setting multiple attributes via function if a condition is met
func (*Tag) ChildIfElse ¶ added in v1.51.0
ChildIfElse adds a child if a condition is met, otherwise adds another child
func (*Tag) ChildrenIf ¶ added in v1.50.0
ChildrenIf adds children if a condition is met
func (*Tag) ChildrenIfElse ¶ added in v1.51.0
ChildrenIfElse adds children if a condition is met
func (*Tag) ChildrenIfF ¶ added in v1.57.0
ChildrenIf adds children using function if a condition is met
func (*Tag) ChildrenMap ¶ added in v1.71.0
ChildrenMap map a slice to a slice of tags and adds as children
func (*Tag) ClassIfElse ¶ added in v1.51.0
ClassIfElse adds class name if a condition is met
func (*Tag) DataIf ¶ added in v1.55.0
DataIf shortcut for setting a "data-" attribute if a condition is met
func (*Tag) DataIfElse ¶ added in v1.55.0
DataIfElse shortcut for setting a "data-" attribute if a condition is met
func (*Tag) GetAttribute ¶
GetAttribute returns the value of an attribute
func (*Tag) HTMLIfElse ¶ added in v1.51.0
HTMLIfElse adds html if a condition is met
func (*Tag) HasClass ¶ added in v1.36.0
HasClass returns true if the tag has a class with the specified name.
func (*Tag) Hx ¶ added in v1.48.0
Hx shortcut for setting an HTMX attribute Htmx attributes have the format of hx-{NAME}="{VALUE}"
func (*Tag) HxSelectOob ¶ added in v1.62.0
func (*Tag) OnDblClick ¶ added in v1.55.0
OnDblClick shortcut for setting the "ondblclick" attribute
func (*Tag) OnKeyPress ¶ added in v1.55.0
OnKeyPress shortcut for setting the "onkeydown" attribute
func (*Tag) OnMouseDown ¶ added in v1.55.0
OnMouseDown shortcut for setting the "onmousedown" attribute
func (*Tag) OnMouseEnter ¶ added in v1.55.0
OnMouseEnter shortcut for setting the "onmouseenter" attribute
func (*Tag) OnMouseLeave ¶ added in v1.55.0
OnMouseLeave shortcut for setting the "onmouseleave" attribute
func (*Tag) OnMouseMove ¶ added in v1.55.0
OnMouseMove shortcut for setting the "onmousemove" attribute
func (*Tag) OnMouseOut ¶ added in v1.55.0
OnMouseOut shortcut for setting the "onmouseout" attribute
func (*Tag) OnMouseOver ¶ added in v1.55.0
OnMouseOver shortcut for setting the "onmouseover" attribute
func (*Tag) Placeholder ¶ added in v1.54.0
Placeholder shortcut for setting the "placeholder" attribute
func (*Tag) SetAttribute ¶
SetAttribute sets the value of an attribute
func (*Tag) StyleIfElse ¶ added in v1.52.0
StyleIfElse adds style if a condition is met
func (*Tag) TextIfElse ¶ added in v1.69.0
TextIfElse adds escaped text if a condition is met
type TagInterface ¶
type TagInterface interface {
ToHTML() string
}
TagInterface represents an HTML tag interface
type Webpage ¶
type Webpage struct { Tag // contains filtered or unexported fields }
Webpage represents a web page
func (*Webpage) AddChildren ¶ added in v1.42.0
AddChildren adds tags to the webpage
func (*Webpage) AddScriptURL ¶
AddScriptURL adds a style URL to the webpage
func (*Webpage) AddScriptURLs ¶
AddScriptURLs adds style URLs to the webpage
func (*Webpage) AddScripts ¶
AddScripts adds scripts to the webpage
func (*Webpage) AddStyleURL ¶
AddStyleURL adds a style URL to the webpage
func (*Webpage) AddStyleURLs ¶
AddStyleURLs adds style URLs to the webpage
func (*Webpage) ScriptURLs ¶
ScriptURLs shortcut for adding script URLs
func (*Webpage) SetAttribute ¶ added in v1.44.0
SetAttribute adds a style to the webpage
func (*Webpage) SetCharset ¶ added in v1.72.1
SetCharset sets the charset of the webpage
func (*Webpage) SetFavicon ¶
SetFavicon sets the favicon of the webpage
func (*Webpage) SetLanguage ¶ added in v1.72.1
SetLanguage sets the language of the webpage
Source Files ¶
- AlpineJS.go
- BorderLayout.go
- Conditions.go
- Htmx.go
- Map.go
- NewBR.go
- NewButton.go
- NewCaption.go
- NewCode.go
- NewDiv.go
- NewFooter.go
- NewForm.go
- NewHR.go
- NewHTML.go
- NewHeader.go
- NewHyperlink.go
- NewI.go
- NewImage.go
- NewInput.go
- NewOption.go
- NewPod.go
- NewSection.go
- NewSelect.go
- NewSpan.go
- NewSwal.go
- NewTable.go
- NewTag.go
- NewTemplate.go
- NewText.go
- NewTextArea.go
- NewUL.go
- NewWebpage.go
- NewWrap.go
- Tag.go
- Ternary.go
- TernaryF.go
- Webpage.go
- addslashes.go
- consts.go
- elements.go
- headings.go
- inArray.go