Documentation
¶
Index ¶
- type Element
- func (e *Element) AddClasses(classes ...string)
- func (e *Element) GetAttributes() templ.Attributes
- func (e *Element) GetClasses() string
- func (e *Element) GetID() string
- func (e *Element) GetTarget() string
- func (e *Element) HasAttribute(key string) bool
- func (e *Element) MergeAttributes(attributes templ.Attributes)
- func (e *Element) SetAttribute(key string, value any)
- func (e *Element) SetID(id string)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct {
ID models.ElementID
Attributes templ.Attributes
Classes []string
// contains filtered or unexported fields
}
Element represents any HTML element that can have attributes and classes.
func (*Element) AddClasses ¶
func (*Element) GetAttributes ¶
func (e *Element) GetAttributes() templ.Attributes
func (*Element) GetClasses ¶
func (*Element) HasAttribute ¶
func (*Element) MergeAttributes ¶
func (e *Element) MergeAttributes(attributes templ.Attributes)
func (*Element) SetAttribute ¶
type Option ¶
type Option func(*Element)
Option is a functional option applied to an Element.
func WithAttribute ¶
WithAttribute option applies the given attribute to the Element.
func WithAttributes ¶
func WithAttributes(attributes templ.Attributes) Option
WithAttributes option applies the set of attributes to the Element. It will merge the set with any existing elements (duplicate existing attributes will be overridden).
func WithClasses ¶
WithClasses option applies the given classes to the Element.
Click to show internal directories.
Click to hide internal directories.