// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-tag package wa import ( "github.com/a-h/templ" ) // Tags are used as labels to organize things or to indicate a selection. // // Web Awesome component: // TagProps holds all properties for the wa-tag component type TagProps struct { // The tag's theme variant. Defaults to neutral if not within another element with a variant. // Valid values: "brand", "neutral", "success", "warning", "danger" Variant string `attr:"variant"` // The tag's visual appearance. // Valid values: "accent", "filled", "outlined", "filled-outlined" Appearance string `attr:"appearance"` // The tag's size. // Valid values: "small", "medium", "large" Size string `attr:"size"` // Draws a pill-style tag with rounded edges. Pill bool `attr:"pill"` // Makes the tag removable and shows a remove button. WithRemove bool `attr:"with-remove"` // Events // Emitted when the remove button is activated. OnRemove string `attr:"x-on:wa-remove"` // Slots contains named slot content Slots TagSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // TagBuilder provides a fluent API for constructing TagProps type TagBuilder struct { props TagProps } // NewTag creates a new builder for wa-tag func NewTag() *TagBuilder { return &TagBuilder{} } // Variant sets the variant attribute // The tag's theme variant. Defaults to neutral if not within another element with a variant. func (b *TagBuilder) Variant(v string) *TagBuilder { b.props.Variant = v return b } // Appearance sets the appearance attribute // The tag's visual appearance. func (b *TagBuilder) Appearance(v string) *TagBuilder { b.props.Appearance = v return b } // Size sets the size attribute // The tag's size. func (b *TagBuilder) Size(v string) *TagBuilder { b.props.Size = v return b } // Pill sets the pill attribute // Draws a pill-style tag with rounded edges. func (b *TagBuilder) Pill(v bool) *TagBuilder { b.props.Pill = v return b } // WithRemove sets the with-remove attribute // Makes the tag removable and shows a remove button. func (b *TagBuilder) WithRemove(v bool) *TagBuilder { b.props.WithRemove = v return b } // OnRemove sets the handler for wa-remove event // Emitted when the remove button is activated. func (b *TagBuilder) OnRemove(handler string) *TagBuilder { b.props.OnRemove = handler return b } // Attr adds a custom HTML attribute func (b *TagBuilder) Attr(name, value string) *TagBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *TagBuilder) Attrs(attrs templ.Attributes) *TagBuilder { 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 *TagBuilder) Props() TagProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *TagBuilder) Build() TagProps { return b.props } // Tag renders the wa-tag component templ Tag(props TagProps) { { children... } } // TagFunc renders with a builder function for inline configuration templ TagFunc(fn func(*TagBuilder)) { {{ b := NewTag(); fn(b) }} @Tag(b.Props()) { { children... } } }