components

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 3 Imported by: 0

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

View Source
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.

View Source
var TailwindMerge = &TailwindMergeProperty{}

TailwindMerge is a global instance of TailwindMergeProperty used to merge conflicting or duplicate tailwind classes.

Functions

func ItemsOf

func ItemsOf(passed []html.Item, items ...html.Item) []html.Item

Merges a list of html.Items with another. Puts the first list of items at the end.

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) Item

func (*AsChildProperty) Item()

Implements the html.Item 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) Apply added in v0.7.0

func (v Size) Apply(el *html.Element)

func (Size) Item added in v0.7.0

func (Size) Item()

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

type Value added in v0.7.0

type Value string

func (Value) Apply added in v0.7.0

func (v Value) Apply(el *html.Element)

func (Value) Item added in v0.7.0

func (Value) Item()

func (Value) LifeCycle added in v0.7.0

func (Value) LifeCycle() html.PropertyLifeCycle

type Variant

type Variant int

func (Variant) Apply

func (v Variant) Apply(el *html.Element)

func (Variant) Item

func (Variant) Item()

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

Jump to

Keyboard shortcuts

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