Documentation
¶
Overview ¶
Package components provides utilities for manipulating HTML elements with custom properties, such as merging Tailwind CSS classes and handling child elements.
The ItemsOf function combines multiple html.Item values, appending the TailwindMerge property to the resulting slice for consistent class merging behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AsChild = &AsChildProperty{}
AsChild is a global instance of AsChildHook used to provide hook functionality for child components within the package. It can be used to manage or modify behavior specific to child components.
var TailwindMerge = &TailwindMergeProperty{}
TailwindMerge is a global instance of TailwindMergeProperty used to merge conflicting or duplicate tailwind classes.
Functions ¶
Types ¶
type AsChildProperty ¶
type AsChildProperty struct{}
The AsChildProperty type allows an element to adopt the properties of its single child element, merging class lists and attributes, and replacing the parent element with the child.
func (*AsChildProperty) Apply ¶
func (*AsChildProperty) Apply(el *html.Element)
Implements the html.Hook interface
func (*AsChildProperty) LifeCycle ¶ added in v0.7.0
func (*AsChildProperty) LifeCycle() html.PropertyLifeCycle
type Size ¶ added in v0.7.0
type Size int
func (Size) LifeCycle ¶ added in v0.7.0
func (Size) LifeCycle() html.PropertyLifeCycle
type SizeApplier ¶ added in v0.7.0
type SizeApplier struct {
// contains filtered or unexported fields
}
func NewSizeApplier ¶ added in v0.7.0
func NewSizeApplier(fn func(*html.Element, Size)) *SizeApplier
func (*SizeApplier) Apply ¶ added in v0.7.0
func (va *SizeApplier) Apply(el *html.Element)
func (*SizeApplier) Item ¶ added in v0.7.0
func (*SizeApplier) Item()
func (*SizeApplier) LifeCycle ¶ added in v0.7.0
func (*SizeApplier) LifeCycle() html.PropertyLifeCycle
type TailwindMergeProperty ¶
type TailwindMergeProperty struct{}
The TailwindMergeProperty type applies Tailwind CSS class merging to an element's class list, ensuring that conflicting or duplicate classes are resolved according to Tailwind's rules.
func (*TailwindMergeProperty) Apply ¶
func (*TailwindMergeProperty) Apply(el *html.Element)
Implements the html.Property interface
func (*TailwindMergeProperty) Item ¶
func (*TailwindMergeProperty) Item()
Implements the html.Item interface
func (*TailwindMergeProperty) LifeCycle ¶
func (*TailwindMergeProperty) LifeCycle() html.PropertyLifeCycle
type Value ¶ added in v0.7.0
type Value string
func (Value) LifeCycle ¶ added in v0.7.0
func (Value) LifeCycle() html.PropertyLifeCycle
type Variant ¶
type Variant int
func (Variant) LifeCycle ¶
func (Variant) LifeCycle() html.PropertyLifeCycle
type VariantApplier ¶
type VariantApplier struct {
// contains filtered or unexported fields
}
func NewVariantApplier ¶
func NewVariantApplier(fn func(*html.Element, Variant)) *VariantApplier
func (*VariantApplier) Apply ¶
func (va *VariantApplier) Apply(el *html.Element)
func (*VariantApplier) Item ¶
func (*VariantApplier) Item()
func (*VariantApplier) LifeCycle ¶
func (*VariantApplier) LifeCycle() html.PropertyLifeCycle