// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-badge package wa import ( "github.com/a-h/templ" ) // Badges are used to draw attention and display statuses or counts. // // Web Awesome component: // BadgeProps holds all properties for the wa-badge component type BadgeProps struct { // The badge's theme variant. Defaults to brand if not within another element with a variant. // Valid values: "brand", "neutral", "success", "warning", "danger" Variant string `attr:"variant"` // The badge's visual appearance. // Valid values: "accent", "filled", "outlined", "filled-outlined" Appearance string `attr:"appearance"` // Draws a pill-style badge with rounded edges. Pill bool `attr:"pill"` // Adds an animation to draw attention to the badge. // Valid values: "none", "pulse", "bounce" Attention string `attr:"attention"` // Events // Slots contains named slot content Slots BadgeSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // BadgeBuilder provides a fluent API for constructing BadgeProps type BadgeBuilder struct { props BadgeProps } // NewBadge creates a new builder for wa-badge func NewBadge() *BadgeBuilder { return &BadgeBuilder{} } // Variant sets the variant attribute // The badge's theme variant. Defaults to brand if not within another element with a variant. func (b *BadgeBuilder) Variant(v string) *BadgeBuilder { b.props.Variant = v return b } // Appearance sets the appearance attribute // The badge's visual appearance. func (b *BadgeBuilder) Appearance(v string) *BadgeBuilder { b.props.Appearance = v return b } // Pill sets the pill attribute // Draws a pill-style badge with rounded edges. func (b *BadgeBuilder) Pill(v bool) *BadgeBuilder { b.props.Pill = v return b } // Attention sets the attention attribute // Adds an animation to draw attention to the badge. func (b *BadgeBuilder) Attention(v string) *BadgeBuilder { b.props.Attention = v return b } // Attr adds a custom HTML attribute func (b *BadgeBuilder) Attr(name, value string) *BadgeBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *BadgeBuilder) Attrs(attrs templ.Attributes) *BadgeBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } for k, v := range attrs { b.props.Attrs[k] = v } return b } // Props returns the built properties func (b *BadgeBuilder) Props() BadgeProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *BadgeBuilder) Build() BadgeProps { return b.props } // Badge renders the wa-badge component templ Badge(props BadgeProps) { { children... } } // BadgeFunc renders with a builder function for inline configuration templ BadgeFunc(fn func(*BadgeBuilder)) { {{ b := NewBadge(); fn(b) }} @Badge(b.Props()) { { children... } } }