// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-comparison package wa import ( "github.com/a-h/templ" ) // Compare visual differences between similar content with a sliding panel. // // Web Awesome component: // ComparisonProps holds all properties for the wa-comparison component type ComparisonProps struct { // The position of the divider as a percentage. Position float64 `attr:"position"` // Events // Emitted when the position changes. OnChange string `attr:"x-on:change"` // Slots contains named slot content Slots ComparisonSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // ComparisonSlots holds named slot content for the component type ComparisonSlots struct { // The before content, often an or element. Before templ.Component // The after content, often an or element. After templ.Component // The icon used inside the handle. Handle templ.Component } // ComparisonBuilder provides a fluent API for constructing ComparisonProps type ComparisonBuilder struct { props ComparisonProps } // NewComparison creates a new builder for wa-comparison func NewComparison() *ComparisonBuilder { return &ComparisonBuilder{} } // Position sets the position attribute // The position of the divider as a percentage. func (b *ComparisonBuilder) Position(v float64) *ComparisonBuilder { b.props.Position = v return b } // OnChange sets the handler for change event // Emitted when the position changes. func (b *ComparisonBuilder) OnChange(handler string) *ComparisonBuilder { b.props.OnChange = handler return b } // BeforeSlot sets the before slot content // The before content, often an or element. func (b *ComparisonBuilder) BeforeSlot(c templ.Component) *ComparisonBuilder { b.props.Slots.Before = c return b } // AfterSlot sets the after slot content // The after content, often an or element. func (b *ComparisonBuilder) AfterSlot(c templ.Component) *ComparisonBuilder { b.props.Slots.After = c return b } // HandleSlot sets the handle slot content // The icon used inside the handle. func (b *ComparisonBuilder) HandleSlot(c templ.Component) *ComparisonBuilder { b.props.Slots.Handle = c return b } // Attr adds a custom HTML attribute func (b *ComparisonBuilder) Attr(name, value string) *ComparisonBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *ComparisonBuilder) Attrs(attrs templ.Attributes) *ComparisonBuilder { 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 *ComparisonBuilder) Props() ComparisonProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *ComparisonBuilder) Build() ComparisonProps { return b.props } // Comparison renders the wa-comparison component templ Comparison(props ComparisonProps) { if props.Slots.Before != nil {
@props.Slots.Before
} if props.Slots.After != nil {
@props.Slots.After
} if props.Slots.Handle != nil {
@props.Slots.Handle
} { children... }
} // ComparisonFunc renders with a builder function for inline configuration templ ComparisonFunc(fn func(*ComparisonBuilder)) { {{ b := NewComparison(); fn(b) }} @Comparison(b.Props()) { { children... } } }