utils

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

templui util templui.go - version: main installed by templui v0.70.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func If

func If[T comparable](condition bool, value T) T

TwIf returns value if condition is true, otherwise an empty value of type T. Example: true, "bg-red-500" → "bg-red-500"

func IfElse

func IfElse[T any](condition bool, trueValue T, falseValue T) T

TwIfElse returns trueValue if condition is true, otherwise falseValue. Example: true, "bg-red-500", "bg-gray-300" → "bg-red-500"

func IsEmptyValue added in v0.24.0

func IsEmptyValue(d string) bool

func IsOverwritableMethod

func IsOverwritableMethod(method string) bool

func IsPathStyles

func IsPathStyles(path, expected, trueStyles, falseStyles string) string

func MergeAttributes

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

MergeAttributes combines multiple Attributes into one. Example: MergeAttributes(attr1, attr2) → combined attributes

func RandomID

func RandomID() string

RandomID generates a random ID string. Example: RandomID() → "id-123456"

func TwMerge

func TwMerge(classes ...string) string

TwMerge combines Tailwind classes and resolves conflicts. 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