Documentation
¶
Overview ¶
TagGroup restricts HTML tags for one primitive semantic group. See tags.spec.md for allowed tags per group.
Package uiutils holds shared Go helpers for registry bricks. See utils.spec.md for machine-readable export catalog.
Index ¶
- Variables
- func AlertAttrs() templ.Attributes
- func AlertClasses(variant, extra string) string
- func AriaControls(id string) templ.Attributes
- func AriaCurrent(value string) templ.Attributes
- func AriaExpanded(v bool) templ.Attributes
- func AriaHasPopup(kind string) templ.Attributes
- func AriaLabel(value string) templ.Attributes
- func AriaLive(value string) templ.Attributes
- func AriaModal(v bool) templ.Attributes
- func AriaPressed(pressed bool) templ.Attributes
- func BreadcrumbItemAttrs(current bool) templ.Attributes
- func BreadcrumbRootAttrs(ariaLabel, dataUI8Kit string, attrs templ.Attributes) templ.Attributes
- func CardClasses(variant, extra string) string
- func Cn(classes ...string) string
- func Compose(v Variants, selection map[string]string, extra ...string) string
- func ControlAttrs(id, role, tabIndex, ariaLabel string, attrs templ.Attributes) templ.Attributes
- func ControlClasses(variant, size string, extra ...string) string
- func DOMAttrs(id, role, tabIndex string, attrs templ.Attributes) templ.Attributes
- func DefaultButtonType(t string) string
- func DefaultInputType(t string) string
- func InputClasses(variant, size string, extra ...string) string
- func IsAllowedTag(tag string, group TagGroup) bool
- func MergeAttrs(parts ...templ.Attributes) templ.Attributes
- func ResolveTag(tag, fallback string, group TagGroup) string
- func SwitchAttrs(id, role, tabIndex, ariaLabel string, checked bool, attrs templ.Attributes) templ.Attributes
- func TextareaRows(rows int) int
- func TitleTag(order int) string
- type TagGroup
- type Variants
Constants ¶
This section is empty.
Variables ¶
var AlertVariants = Variants{ Base: "rounded-lg border px-4 py-3 shadow-sm outline-none ring-offset-background gap-6", Keys: []string{"variant"}, Defaults: map[string]string{"variant": ""}, ByKey: map[string]map[string]string{ "variant": { "": "bg-card text-card-foreground", "default": "bg-card text-card-foreground", "destructive": "border-destructive bg-destructive/10 text-destructive", "success": "border-primary bg-primary/10 text-primary", "warning": "border-border bg-accent text-accent-foreground", }, }, }
AlertVariants is the alert surface recipe.
var CardVariants = Variants{ Base: "rounded-md border border-border bg-card text-card-foreground shadow-sm", Keys: []string{"variant"}, Defaults: map[string]string{"variant": ""}, ByKey: map[string]map[string]string{ "variant": { "": "", "default": "", "raised": "", "kpi": "bg-card/50", "muted": "bg-muted/40", "ghost": "border-dashed bg-background shadow-none", "compact": "p-3", "flat": "shadow-none", "accent": "border-transparent bg-accent/30", }, }, }
CardVariants is the card surface recipe.
var ControlChrome = Variants{ Base: "rounded border border-primary text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", Keys: []string{"variant"}, Defaults: map[string]string{"variant": ""}, ByKey: map[string]map[string]string{ "variant": { "unstyled": "", "": "border-primary", "default": "border-primary", "outline": "border-primary", "ghost": "border-primary bg-muted/30", }, }, }
var ControlSize = Variants{ Keys: []string{"size"}, Defaults: map[string]string{"size": "default"}, ByKey: map[string]map[string]string{ "size": { "": "h-4 w-4", "default": "h-4 w-4", "md": "h-4 w-4", "xs": "h-3 w-3", "sm": "h-3.5 w-3.5", "lg": "h-5 w-5", }, }, }
var InputChrome = Variants{ Base: "w-full rounded-md border px-3 py-2 text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", Keys: []string{"variant"}, Defaults: map[string]string{"variant": ""}, ByKey: map[string]map[string]string{ "variant": { "unstyled": "", "": "border-border bg-background", "default": "border-border bg-background", "outline": "border-border bg-background", "ghost": "border-transparent bg-muted", }, }, }
Form control class recipes (shared by input, textarea, select, checkbox, radio, switch).
var InputSize = Variants{ Keys: []string{"size"}, Defaults: map[string]string{"size": "default"}, ByKey: map[string]map[string]string{ "size": { "": "h-10 px-3 py-2 text-sm", "default": "h-10 px-3 py-2 text-sm", "md": "h-10 px-3 py-2 text-sm", "xs": "h-8 px-2 text-xs", "sm": "h-9 px-3 text-sm", "lg": "h-11 px-4 text-base", }, }, }
Functions ¶
func AlertClasses ¶
AlertClasses merges alert variant presets.
func AriaControls ¶
func AriaControls(id string) templ.Attributes
func AriaCurrent ¶
func AriaCurrent(value string) templ.Attributes
func AriaHasPopup ¶
func AriaHasPopup(kind string) templ.Attributes
func AriaLabel ¶
func AriaLabel(value string) templ.Attributes
func AriaLive ¶
func AriaLive(value string) templ.Attributes
func AriaModal ¶
func AriaModal(v bool) templ.Attributes
func AriaPressed ¶
func AriaPressed(pressed bool) templ.Attributes
func BreadcrumbItemAttrs ¶
func BreadcrumbItemAttrs(current bool) templ.Attributes
BreadcrumbItemAttrs returns per-item attrs.
func BreadcrumbRootAttrs ¶
func BreadcrumbRootAttrs(ariaLabel, dataUI8Kit string, attrs templ.Attributes) templ.Attributes
BreadcrumbRootAttrs returns nav root attrs from explicit props.
func CardClasses ¶
CardClasses merges card variant presets.
func ControlAttrs ¶
func ControlAttrs(id, role, tabIndex, ariaLabel string, attrs templ.Attributes) templ.Attributes
ControlAttrs spreads field attrs without duplicating id on the element.
func ControlClasses ¶
ControlClasses composes checkbox/radio/switch classes.
func DOMAttrs ¶
func DOMAttrs(id, role, tabIndex string, attrs templ.Attributes) templ.Attributes
DOMAttrs merges ID, role, tabindex, and custom attrs.
func DefaultButtonType ¶
DefaultButtonType returns button when empty.
func DefaultInputType ¶
DefaultInputType returns text when empty.
func InputClasses ¶
InputClasses composes input/textarea/select classes.
func IsAllowedTag ¶
IsAllowedTag reports whether tag is valid for the semantic group.
func MergeAttrs ¶
func MergeAttrs(parts ...templ.Attributes) templ.Attributes
MergeAttrs merges attribute maps left to right.
func ResolveTag ¶
ResolveTag returns tag when allowed for group, otherwise fallback.
func SwitchAttrs ¶
func SwitchAttrs(id, role, tabIndex, ariaLabel string, checked bool, attrs templ.Attributes) templ.Attributes
SwitchAttrs adds switch semantics on checkbox controls.
Types ¶
type TagGroup ¶
type TagGroup int
TagGroup restricts which HTML tags a primitive may render.
const ( TagGroupLayout TagGroup = iota TagGroupBlockText TagGroupInline TagGroupHeading TagGroupList TagGroupListItem TagGroupForm TagGroupFormControl TagGroupFormLabel TagGroupTable TagGroupTableSection TagGroupTableRow TagGroupTableCell TagGroupTableColumn TagGroupMedia TagGroupDisclosure TagGroupStack TagGroupGroup TagGroupText TagGroupContainer )