element

package
v0.77.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

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 New

func New() *Element

func (*Element) AddClasses

func (e *Element) AddClasses(classes ...string)

func (*Element) GetAttributes

func (e *Element) GetAttributes() templ.Attributes

func (*Element) GetClasses

func (e *Element) GetClasses() string

func (*Element) GetID

func (e *Element) GetID() string

func (*Element) GetTarget

func (e *Element) GetTarget() string

func (*Element) HasAttribute

func (e *Element) HasAttribute(key string) bool

func (*Element) MergeAttributes

func (e *Element) MergeAttributes(attributes templ.Attributes)

func (*Element) SetAttribute

func (e *Element) SetAttribute(key string, value any)

func (*Element) SetID

func (e *Element) SetID(id string)

type Option

type Option func(*Element)

Option is a functional option applied to an Element.

func WithAttribute

func WithAttribute(key string, value any) Option

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

func WithClasses(classes ...string) Option

WithClasses option applies the given classes to the Element.

func WithID

func WithID(id string) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL