Documentation
¶
Index ¶
- Constants
- func EscapeString(s string) string
- func GetOptionLabel(value string, options []Option) string
- type DefaultElement
- func (e *DefaultElement) AddChild(child Element) Element
- func (e *DefaultElement) Alt(alt string) Element
- func (e *DefaultElement) AtClick(handler string) Element
- func (e *DefaultElement) Attr(key string, value ...string) Element
- func (e *DefaultElement) ChildWithId(id string) (Element, bool)
- func (e *DefaultElement) Children(elements ...Element) Element
- func (e *DefaultElement) Class(classes ...string) Element
- func (e *DefaultElement) For(value string) Element
- func (e *DefaultElement) GetAttr(key string) string
- func (e *DefaultElement) GetAttrs() map[string]string
- func (e *DefaultElement) GetChild(idx int) (Element, bool)
- func (e *DefaultElement) GetChildren() []Element
- func (e *DefaultElement) GetChildrenWithClass(class string) []Element
- func (e *DefaultElement) GetClasses() []string
- func (e *DefaultElement) GetContent() string
- func (e *DefaultElement) GetFirstChildWithClass(class string) (Element, bool)
- func (e *DefaultElement) GetId() string
- func (e *DefaultElement) GetNthChildWithClass(class string, n int) (Element, bool)
- func (e *DefaultElement) GetStyle(key string) string
- func (e *DefaultElement) GetStyles() map[string]string
- func (e *DefaultElement) GetTag() string
- func (e *DefaultElement) HXBoost(boost ...bool) Element
- func (e *DefaultElement) HXConfirm(prompt string) Element
- func (e *DefaultElement) HXDelete(url string) Element
- func (e *DefaultElement) HXGet(url string) Element
- func (e *DefaultElement) HXIndicator(indicator string) Element
- func (e *DefaultElement) HXOn(event string, script string) Element
- func (e *DefaultElement) HXOob(oob string) Element
- func (e *DefaultElement) HXPatch(url string) Element
- func (e *DefaultElement) HXPost(url string) Element
- func (e *DefaultElement) HXPushUrl(pushUrl ...bool) Element
- func (e *DefaultElement) HXPut(url string) Element
- func (e *DefaultElement) HXSelect(value string) Element
- func (e *DefaultElement) HXSwap(value string) Element
- func (e *DefaultElement) HXSwapOob(oob string) Element
- func (e *DefaultElement) HXTarget(target string) Element
- func (e *DefaultElement) HXTrigger(trigger string) Element
- func (e *DefaultElement) HXVals(json string) Element
- func (e *DefaultElement) HasClass(class string) bool
- func (e *DefaultElement) Href(href string) Element
- func (e *DefaultElement) Id(value string) Element
- func (e *DefaultElement) Name(name string) Element
- func (e *DefaultElement) OnClick(value string) Element
- func (e *DefaultElement) Placeholder(placeholder string) Element
- func (e *DefaultElement) PrependChild(child Element) Element
- func (e *DefaultElement) RemoveAttr(keys ...string) Element
- func (e *DefaultElement) RemoveClass(classes ...string) Element
- func (e *DefaultElement) RemoveStyle(styles ...string) Element
- func (e *DefaultElement) Render() string
- func (e *DefaultElement) RenderWithContent(text string, children ...Element) string
- func (e *DefaultElement) Send(w http.ResponseWriter)
- func (e *DefaultElement) Src(src string) Element
- func (e *DefaultElement) Style(style string) Element
- func (e *DefaultElement) Submit() Element
- func (e *DefaultElement) Tag(tag string) Element
- func (e *DefaultElement) Text(content string) Element
- func (e *DefaultElement) Type(tipe string) Element
- func (e *DefaultElement) UnsafeHtml(content string) Element
- func (e *DefaultElement) Value(value string) Element
- func (e *DefaultElement) XBind(attr string, value string) Element
- func (e *DefaultElement) XCloak() Element
- func (e *DefaultElement) XData(data string) Element
- func (e *DefaultElement) XHtml(value string) Element
- func (e *DefaultElement) XInit(value string) Element
- func (e *DefaultElement) XModel(value string) Element
- func (e *DefaultElement) XOn(event string, value string) Element
- func (e *DefaultElement) XRef(value string) Element
- func (e *DefaultElement) XShow(condition string) Element
- func (e *DefaultElement) XText(value string) Element
- type Element
- func A(href string, children ...Element) Element
- func Body(children ...Element) Element
- func Button(text string) Element
- func Div(class string, children ...Element) Element
- func Form() Element
- func Fragment(children ...Element) Element
- func H1(text string) Element
- func H2(text string) Element
- func H3(text string) Element
- func H4(text string) Element
- func H5(text string) Element
- func H6(text string) Element
- func Head(children ...Element) Element
- func Html(content string) Element
- func Img(src string) Element
- func Input(name string) Element
- func Label(text string) Element
- func List[T any](data []T, rowFunc ...func(T, int) Element) Element
- func NewElement(tag string) Element
- func None() Element
- func P(text string) Element
- func Script(js string) Element
- func Section(children ...Element) Element
- func Span(text string) Element
- func Style(css string) Element
- func Stylesheet(url string) Element
- func Svg(path string, width int, height int, vbX int, vbY int) Element
- func Template(filename string) Element
- func VideoIframe(title string, width int, height int, src string) Element
- type FieldElement
- func (f *FieldElement) Checked(value ...bool) *FieldElement
- func (f *FieldElement) Email(is_email ...bool) *FieldElement
- func (f *FieldElement) Error(err string) *FieldElement
- func (f *FieldElement) GetError() Element
- func (f *FieldElement) GetInput() Element
- func (f *FieldElement) GetLabel() Element
- func (f *FieldElement) GetValue() string
- func (f *FieldElement) GetWrapper() Element
- func (f *FieldElement) HXDelete(value string) Element
- func (f *FieldElement) HXGet(value string) Element
- func (f *FieldElement) HXPatch(value string) Element
- func (f *FieldElement) HXPost(value string) Element
- func (f *FieldElement) HXPut(value string) Element
- func (f *FieldElement) HXSwap(value string) Element
- func (f *FieldElement) HXTarget(value string) Element
- func (f *FieldElement) Id(id string) Element
- func (f *FieldElement) Label(label string) *FieldElement
- func (f *FieldElement) Name(name string) Element
- func (f *FieldElement) Password(is_password ...bool) *FieldElement
- func (f *FieldElement) Render() string
- func (f *FieldElement) Required(required ...bool) *FieldElement
- func (f *FieldElement) SetError(e Element) *FieldElement
- func (f *FieldElement) SetInput(e Element) *FieldElement
- func (f *FieldElement) SetLabel(l Element) *FieldElement
- func (f *FieldElement) Type(tipe string) Element
- func (f *FieldElement) Value(value string) Element
- type Option
Constants ¶
const ( FieldLabel fieldElementIndex = iota FieldInput FieldError FieldCheck FieldOptions )
Variables ¶
This section is empty.
Functions ¶
func EscapeString ¶ added in v0.4.0
Escapes a string to ensure it is safe HTML. Doesnt remove apostrophe
func GetOptionLabel ¶ added in v0.2.13
Returns the label for a given value in a list of options
Types ¶
type DefaultElement ¶ added in v0.2.0
type DefaultElement struct {
// contains filtered or unexported fields
}
func NewDefaultElement ¶ added in v0.2.0
func NewDefaultElement(tag string) DefaultElement
Returns a new DefaultElement with the given tag.
func (*DefaultElement) AddChild ¶ added in v0.2.0
func (e *DefaultElement) AddChild(child Element) Element
Appends the element as a child.
func (*DefaultElement) Alt ¶ added in v0.2.0
func (e *DefaultElement) Alt(alt string) Element
Sets the alt attribute of the element.
func (*DefaultElement) AtClick ¶ added in v0.5.2
func (e *DefaultElement) AtClick(handler string) Element
Sets @click attribute for alpine.js
func (*DefaultElement) Attr ¶ added in v0.2.0
func (e *DefaultElement) Attr(key string, value ...string) Element
Sets the given attribute key to the given value.
func (*DefaultElement) ChildWithId ¶ added in v0.5.0
func (e *DefaultElement) ChildWithId(id string) (Element, bool)
Returns the first child element with the given id recursively.
func (*DefaultElement) Children ¶ added in v0.2.0
func (e *DefaultElement) Children(elements ...Element) Element
Sets the children of the element.
func (*DefaultElement) Class ¶ added in v0.2.0
func (e *DefaultElement) Class(classes ...string) Element
Adds the given class or classes to the element.
func (*DefaultElement) For ¶ added in v0.2.13
func (e *DefaultElement) For(value string) Element
Sets the for attribute of the element.
func (*DefaultElement) GetAttr ¶ added in v0.2.0
func (e *DefaultElement) GetAttr(key string) string
Returns the value of the given attribute key.
func (*DefaultElement) GetAttrs ¶ added in v0.2.0
func (e *DefaultElement) GetAttrs() map[string]string
Returns a map of the attributes on the element.
func (*DefaultElement) GetChild ¶ added in v0.4.3
func (e *DefaultElement) GetChild(idx int) (Element, bool)
Returns the child element at the given index.
func (*DefaultElement) GetChildren ¶ added in v0.2.0
func (e *DefaultElement) GetChildren() []Element
Returns the children of the element.
func (*DefaultElement) GetChildrenWithClass ¶ added in v0.5.2
func (e *DefaultElement) GetChildrenWithClass(class string) []Element
Returns all descendants with the given class.
func (*DefaultElement) GetClasses ¶ added in v0.2.0
func (e *DefaultElement) GetClasses() []string
Returns an array of all the classes of the element.
func (*DefaultElement) GetContent ¶ added in v0.5.2
func (e *DefaultElement) GetContent() string
Returns the rendered children and text.
func (*DefaultElement) GetFirstChildWithClass ¶ added in v0.5.2
func (e *DefaultElement) GetFirstChildWithClass(class string) (Element, bool)
Returns the first descendant with the given class.
func (*DefaultElement) GetId ¶ added in v0.5.0
func (e *DefaultElement) GetId() string
Returns the id of the element.
func (*DefaultElement) GetNthChildWithClass ¶ added in v0.5.2
func (e *DefaultElement) GetNthChildWithClass(class string, n int) (Element, bool)
Returns the nth descendant with the given class.
func (*DefaultElement) GetStyle ¶ added in v0.2.0
func (e *DefaultElement) GetStyle(key string) string
Returns the value of the given style key.
func (*DefaultElement) GetStyles ¶ added in v0.2.0
func (e *DefaultElement) GetStyles() map[string]string
Returns a map of the styles on the element.
func (*DefaultElement) GetTag ¶ added in v0.2.0
func (e *DefaultElement) GetTag() string
Returns the HTML tag name of the element.
func (*DefaultElement) HXBoost ¶ added in v0.5.2
func (e *DefaultElement) HXBoost(boost ...bool) Element
Sets the hx-boost attribute of the element.
func (*DefaultElement) HXConfirm ¶ added in v0.5.2
func (e *DefaultElement) HXConfirm(prompt string) Element
Sets the hx-confirm attribute of the element.
func (*DefaultElement) HXDelete ¶ added in v0.5.2
func (e *DefaultElement) HXDelete(url string) Element
Sets the hx-delete attribute of the element.
func (*DefaultElement) HXGet ¶ added in v0.5.2
func (e *DefaultElement) HXGet(url string) Element
Sets the hx-get attribute of the element.
func (*DefaultElement) HXIndicator ¶ added in v0.5.2
func (e *DefaultElement) HXIndicator(indicator string) Element
Sets the hx-indicator attribute of the element.
func (*DefaultElement) HXOn ¶ added in v0.5.2
func (e *DefaultElement) HXOn(event string, script string) Element
Sets hx-on attribute for htmx
func (*DefaultElement) HXOob ¶ added in v0.5.2
func (e *DefaultElement) HXOob(oob string) Element
Sets the hx-oob attribute of the element.
func (*DefaultElement) HXPatch ¶ added in v0.5.2
func (e *DefaultElement) HXPatch(url string) Element
Sets the hx-patch attribute of the element.
func (*DefaultElement) HXPost ¶ added in v0.5.2
func (e *DefaultElement) HXPost(url string) Element
Sets the hx-post attribute of the element.
func (*DefaultElement) HXPushUrl ¶ added in v0.5.2
func (e *DefaultElement) HXPushUrl(pushUrl ...bool) Element
Sets the hx-push-url attribute of the element.
func (*DefaultElement) HXPut ¶ added in v0.5.2
func (e *DefaultElement) HXPut(url string) Element
Sets the hx-put attribute of the element.
func (*DefaultElement) HXSelect ¶ added in v0.5.2
func (e *DefaultElement) HXSelect(value string) Element
Sets the hx-select attribute of the element.
func (*DefaultElement) HXSwap ¶ added in v0.5.2
func (e *DefaultElement) HXSwap(value string) Element
Sets the hx-swap attribute of the element.
func (*DefaultElement) HXSwapOob ¶ added in v0.5.2
func (e *DefaultElement) HXSwapOob(oob string) Element
Sets the hx-swap-oob attribute of the element.
func (*DefaultElement) HXTarget ¶ added in v0.5.2
func (e *DefaultElement) HXTarget(target string) Element
Sets the hx-target attribute of the element.
func (*DefaultElement) HXTrigger ¶ added in v0.5.2
func (e *DefaultElement) HXTrigger(trigger string) Element
Sets the hx-trigger attribute of the element.
func (*DefaultElement) HXVals ¶ added in v0.5.2
func (e *DefaultElement) HXVals(json string) Element
Sets the hx-vals attribute of the element.
func (*DefaultElement) HasClass ¶ added in v0.2.0
func (e *DefaultElement) HasClass(class string) bool
Returns true if the element has the given class.
func (*DefaultElement) Href ¶ added in v0.2.0
func (e *DefaultElement) Href(href string) Element
Sets the href attribute of the element.
func (*DefaultElement) Id ¶ added in v0.2.0
func (e *DefaultElement) Id(value string) Element
Sets the id attribute of the element.
func (*DefaultElement) Name ¶ added in v0.2.0
func (e *DefaultElement) Name(name string) Element
Sets the name attribute of the element.
func (*DefaultElement) OnClick ¶ added in v0.2.0
func (e *DefaultElement) OnClick(value string) Element
Sets the onclick attribute of the element.
func (*DefaultElement) Placeholder ¶ added in v0.2.0
func (e *DefaultElement) Placeholder(placeholder string) Element
Sets the placeholder attribute of the element.
func (*DefaultElement) PrependChild ¶ added in v0.2.0
func (e *DefaultElement) PrependChild(child Element) Element
Prepends the element as a child.
func (*DefaultElement) RemoveAttr ¶ added in v0.2.0
func (e *DefaultElement) RemoveAttr(keys ...string) Element
Removes the given attribute key from the element.
func (*DefaultElement) RemoveClass ¶ added in v0.2.0
func (e *DefaultElement) RemoveClass(classes ...string) Element
Removes the given class or classes from the element.
func (*DefaultElement) RemoveStyle ¶ added in v0.2.0
func (e *DefaultElement) RemoveStyle(styles ...string) Element
Removes the given style key from the element.
func (*DefaultElement) Render ¶ added in v0.2.0
func (e *DefaultElement) Render() string
Renders the element as HTML string.
func (*DefaultElement) RenderWithContent ¶ added in v0.4.4
func (e *DefaultElement) RenderWithContent(text string, children ...Element) string
Renders the element with the children first and text at the end.
func (*DefaultElement) Send ¶ added in v0.2.13
func (e *DefaultElement) Send(w http.ResponseWriter)
Sends the element to the http.ResponseWriter as text/html.
func (*DefaultElement) Src ¶ added in v0.2.0
func (e *DefaultElement) Src(src string) Element
Sets the src attribute of the element.
func (*DefaultElement) Style ¶ added in v0.2.0
func (e *DefaultElement) Style(style string) Element
Sets the given style key to the given value.
func (*DefaultElement) Submit ¶ added in v0.2.0
func (e *DefaultElement) Submit() Element
Sets the type attribute to "submit".
func (*DefaultElement) Tag ¶ added in v0.2.0
func (e *DefaultElement) Tag(tag string) Element
Sets the HTML tag name of the element.
func (*DefaultElement) Text ¶ added in v0.2.0
func (e *DefaultElement) Text(content string) Element
Sets the text content of the element.
func (*DefaultElement) Type ¶ added in v0.2.0
func (e *DefaultElement) Type(tipe string) Element
Sets the type attribute of the element.
func (*DefaultElement) UnsafeHtml ¶ added in v0.4.0
func (e *DefaultElement) UnsafeHtml(content string) Element
Sets the text content of the element without escaping.
func (*DefaultElement) Value ¶ added in v0.2.0
func (e *DefaultElement) Value(value string) Element
Sets the value attribute of the element.
func (*DefaultElement) XBind ¶ added in v0.4.0
func (e *DefaultElement) XBind(attr string, value string) Element
Sets x-bind attribute for alpine.js
func (*DefaultElement) XCloak ¶ added in v0.4.0
func (e *DefaultElement) XCloak() Element
Sets x-cloak attribute for alpine.js
func (*DefaultElement) XData ¶ added in v0.4.0
func (e *DefaultElement) XData(data string) Element
Sets x-data attribute for alpine.js
func (*DefaultElement) XHtml ¶ added in v0.4.0
func (e *DefaultElement) XHtml(value string) Element
Sets x-html attribute for alpine.js
func (*DefaultElement) XInit ¶ added in v0.4.0
func (e *DefaultElement) XInit(value string) Element
Sets x-init attribute for alpine.js
func (*DefaultElement) XModel ¶ added in v0.4.0
func (e *DefaultElement) XModel(value string) Element
Sets x-model attribute for alpine.js
func (*DefaultElement) XOn ¶ added in v0.4.0
func (e *DefaultElement) XOn(event string, value string) Element
Sets x-on attribute for alpine.js
func (*DefaultElement) XRef ¶ added in v0.5.8
func (e *DefaultElement) XRef(value string) Element
Sets x-ref attribute for alpine.js
func (*DefaultElement) XShow ¶ added in v0.4.0
func (e *DefaultElement) XShow(condition string) Element
Sets x-show attribute for alpine.js
func (*DefaultElement) XText ¶ added in v0.4.0
func (e *DefaultElement) XText(value string) Element
Sets x-text attribute for alpine.js
type Element ¶
type Element interface { // Returns the HTML tag name of the element. GetTag() string // Sets the HTML tag name of the element. Tag(tag string) Element // Returns the id of the element. GetId() string // Returns the first child element with the given id recursively. ChildWithId(id string) (Element, bool) // Returns an array of all the classes of the element. GetClasses() []string // Returns true if the element has the given class. HasClass(class string) bool // Adds the given class or classes to the element. Class(classes ...string) Element // Removes the given class or classes from the element. RemoveClass(class ...string) Element // Returns a map of the styles on the element. GetStyles() map[string]string // Returns the value of the given style key. GetStyle(key string) string // Sets the given style key to the given value. Style(style string) Element // Removes the given style key from the element. RemoveStyle(key ...string) Element // Returns a map of the attributes on the element. GetAttrs() map[string]string // Returns the value of the given attribute key. GetAttr(key string) string // Sets the given attribute key to the given value. Attr(key string, value ...string) Element // Removes the given attribute key from the element. RemoveAttr(key ...string) Element // Returns the children of the element. GetChildren() []Element // Returns the child element at the given index. GetChild(idx int) (Element, bool) // Appends the element as a child. AddChild(child Element) Element // Prepends the element as a child. PrependChild(child Element) Element // Sets the children of the element. Children(children ...Element) Element // Returns all descendants with the given class. GetChildrenWithClass(class string) []Element // Returns the first descendant with the given class. GetFirstChildWithClass(class string) (Element, bool) // Returns the nth descendant with the given class. GetNthChildWithClass(class string, n int) (Element, bool) // Returns the rendered children and text. GetContent() string // Renders the element as HTML string. Render() string // Sets the text content of the element. Text(content string) Element // Sets the HTML content of the element without escaping. UnsafeHtml(content string) Element // Sets the hx-post attribute of the element. HXPost(url string) Element // Sets the hx-get attribute of the element. HXGet(url string) Element // Sets the hx-put attribute of the element. HXPut(url string) Element // Sets the hx-patch attribute of the element. HXPatch(url string) Element // Sets the hx-delete attribute of the element. HXDelete(url string) Element // Sets the hx-confirm attribute of the element. HXConfirm(prompt string) Element // Sets the hx-target attribute of the element. HXTarget(target string) Element // Sets the hx-trigger attribute of the element. HXTrigger(trigger string) Element // Sets the hx-swap attribute of the element. HXSwap(value string) Element // Sets the hx-select attribute of the element. HXSelect(value string) Element // Sets the id attribute of the element. Id(value string) Element // Sets the name attribute of the element. Name(name string) Element // Sets the for attribute of the element. For(name string) Element // Sets the type attribute of the element. Type(tipe string) Element // Sets the type attribute to "submit". Submit() Element // Sets the src attribute of the element. Src(src string) Element // Sets the value attribute of the element. Value(value string) Element // Sets the href attribute of the element. Href(href string) Element // Sets the placeholder attribute of the element. Placeholder(placeholder string) Element // Sets the alt attribute of the element. Alt(alt string) Element // Sets the onclick attribute of the element. OnClick(value string) Element // Sets the hx-indicator attribute of the element. HXIndicator(indicator string) Element // Sets the hx-oob attribute of the element. HXOob(oob string) Element // Sets the hx-swap-oob attribute of the element. HXSwapOob(oob string) Element // Sets the hx-vals attribute of the element. HXVals(json string) Element // Sets the hx-push-url attribute of the element. HXPushUrl(pushUrl ...bool) Element // Sets hx-on attribute for htmx HXOn(event string, value string) Element // Sets the hx-boost attribute of the element. HXBoost(boost ...bool) Element // Sets x-data attribute for alpine.js XData(data string) Element // Sets @click attribute for alpine.js AtClick(handler string) Element // Sets x-bind attribute for alpine.js XBind(attr string, value string) Element // Sets x-on attribute for alpine.js XOn(event string, value string) Element // Sets x-text attribute for alpine.js XText(value string) Element // Sets x-html attribute for alpine.js XHtml(value string) Element // Sets x-model attribute for alpine.js XModel(value string) Element // Sets x-show attribute for alpine.js XShow(condition string) Element // Sets x-init attribute for alpine.js XInit(value string) Element // Sets x-ref attribute for alpine.js XRef(value string) Element // Sets x-cloak attribute for alpine.js XCloak() Element Send(w http.ResponseWriter) }
func List ¶ added in v0.1.40
Returns a list of elements from the given data wrapped in a div using an optional function to render each item.
func Stylesheet ¶ added in v0.5.7
type FieldElement ¶ added in v0.2.0
type FieldElement struct { DefaultElement Renderer func(f *FieldElement) string }
FieldElement is a struct that represents a field element in a form.
func Checkbox ¶ added in v0.1.7
func Checkbox(name string, label string) *FieldElement
Returns a checkbox field with the given name and label
func Field ¶ added in v0.1.37
func Field(name string, label string, value string) *FieldElement
Returns a FieldElement with label, input, and error(span) elements
func Select ¶ added in v0.1.25
func Select(name string, label string, value string, options []Option, renderOption ...func(Option, string) Element) *FieldElement
Returns a select field with the given name, label, value, and options
func (*FieldElement) Checked ¶ added in v0.2.0
func (f *FieldElement) Checked(value ...bool) *FieldElement
Sets the checked value of a checkbox
func (*FieldElement) Email ¶ added in v0.2.0
func (f *FieldElement) Email(is_email ...bool) *FieldElement
Sets the type of the input element to "email" if is_email is not specified or true Sets type to "text" if is_email is false
func (*FieldElement) Error ¶ added in v0.2.0
func (f *FieldElement) Error(err string) *FieldElement
Sets the Error message of the element
func (*FieldElement) GetError ¶ added in v0.2.0
func (f *FieldElement) GetError() Element
Returns the error element of the field
func (*FieldElement) GetInput ¶ added in v0.2.0
func (f *FieldElement) GetInput() Element
Returns the input element of the field
func (*FieldElement) GetLabel ¶ added in v0.2.0
func (f *FieldElement) GetLabel() Element
Returns the label element of the field
func (*FieldElement) GetValue ¶ added in v0.5.5
func (f *FieldElement) GetValue() string
Returns the value of the input field
func (*FieldElement) GetWrapper ¶ added in v0.2.2
func (f *FieldElement) GetWrapper() Element
Returns the wrapper element of the field This is useful because it returns an Element instead of a FieldElement
func (*FieldElement) HXDelete ¶ added in v0.5.2
func (f *FieldElement) HXDelete(value string) Element
Sets the hx-delete attribute on the input element
func (*FieldElement) HXGet ¶ added in v0.5.2
func (f *FieldElement) HXGet(value string) Element
Sets the hx-get attribute on the input element
func (*FieldElement) HXPatch ¶ added in v0.5.2
func (f *FieldElement) HXPatch(value string) Element
Sets the hx-patch attribute on the input element
func (*FieldElement) HXPost ¶ added in v0.5.2
func (f *FieldElement) HXPost(value string) Element
Sets the hx-post attribute on the input element
func (*FieldElement) HXPut ¶ added in v0.5.2
func (f *FieldElement) HXPut(value string) Element
Sets the hx-put attribute on the input element
func (*FieldElement) HXSwap ¶ added in v0.5.2
func (f *FieldElement) HXSwap(value string) Element
Sets the hx-swap attribute on the input element
func (*FieldElement) HXTarget ¶ added in v0.5.2
func (f *FieldElement) HXTarget(value string) Element
Sets the hx-target attribute on the input element
func (*FieldElement) Id ¶ added in v0.2.0
func (f *FieldElement) Id(id string) Element
Sets the id attribute of the input element, updates the for attribute on the label, and the id on the error span
func (*FieldElement) Label ¶ added in v0.2.0
func (f *FieldElement) Label(label string) *FieldElement
Sets the label text of the field
func (*FieldElement) Name ¶ added in v0.2.0
func (f *FieldElement) Name(name string) Element
Sets the name attribute of the input element. Also updates the id on the field to name + "-field"
func (*FieldElement) Password ¶ added in v0.2.13
func (f *FieldElement) Password(is_password ...bool) *FieldElement
Sets the type of the input element to "password" if is_password is not specified or true Sets type to "text" if is_password is false
func (*FieldElement) Render ¶ added in v0.4.3
func (f *FieldElement) Render() string
Renders the field to an HTML string
func (*FieldElement) Required ¶ added in v0.2.0
func (f *FieldElement) Required(required ...bool) *FieldElement
Sets the required and onblur attributes of the input element
func (*FieldElement) SetError ¶ added in v0.2.0
func (f *FieldElement) SetError(e Element) *FieldElement
Sets the error element of the field
func (*FieldElement) SetInput ¶ added in v0.2.0
func (f *FieldElement) SetInput(e Element) *FieldElement
Sets the input element of the field
func (*FieldElement) SetLabel ¶ added in v0.2.0
func (f *FieldElement) SetLabel(l Element) *FieldElement
Sets the label element of the field
func (*FieldElement) Type ¶ added in v0.2.0
func (f *FieldElement) Type(tipe string) Element
Sets the type attribute on the input element
func (*FieldElement) Value ¶ added in v0.2.0
func (f *FieldElement) Value(value string) Element
Sets the value attribute of the input element