utils

package
v0.0.0-...-fd61a54 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeAttributes

func MergeAttributes(attrs ...templ.Attributes) templ.Attributes

mergeAttributes merges multiple Attributes into one

func RandomID

func RandomID() string

RandomID returns a random ID string Example: "id-123456"

func TwIf

func TwIf(class string, condition bool) string

TwIf returns a class if a condition is true, otherwise an empty string Example: "bg-red-500", true → "bg-red-500", false → ""

func TwIfElse

func TwIfElse(condition bool, trueClass string, falseClass string) string

TwIfElse returns trueClass if condition is true, otherwise falseClass Example: true, "bg-red-500", "bg-gray-300" → "bg-red-500", false, "bg-red-500", "bg-gray-300" → "bg-gray-300"

func TwMerge

func TwMerge(classes ...string) string

TwMerge combines Tailwind classes and handles conflicts. Later classes override earlier ones with the same base. Example: "bg-red-500 hover:bg-blue-500", "bg-green-500" → "hover:bg-blue-500 bg-green-500"

Types

This section is empty.

Jump to

Keyboard shortcuts

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