// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-popover package wa import ( "github.com/a-h/templ" ) // Popovers display contextual content and interactive elements in a floating panel. // // Web Awesome component: // PopoverProps holds all properties for the wa-popover component type PopoverProps struct { // The preferred placement of the popover. Note that the actual placement may vary as needed to keep the popover // Valid values: "top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end" Placement string `attr:"placement"` // Shows or hides the popover. Open bool `attr:"open"` // The distance in pixels from which to offset the popover away from its target. Distance float64 `attr:"distance"` // The distance in pixels from which to offset the popover along its target. Skidding float64 `attr:"skidding"` // The ID of the popover's anchor element. This must be an interactive/focusable element such as a button. For string `attr:"for"` // Removes the arrow from the popover. WithoutArrow bool `attr:"without-arrow"` // Events // Emitted when the popover begins to show. Canceling this event will stop the popover from showing. OnShow string `attr:"x-on:wa-show"` // Emitted after the popover has shown and all animations are complete. OnAfterShow string `attr:"x-on:wa-after-show"` // Emitted when the popover begins to hide. Canceling this event will stop the popover from hiding. OnHide string `attr:"x-on:wa-hide"` // Emitted after the popover has hidden and all animations are complete. OnAfterHide string `attr:"x-on:wa-after-hide"` // Slots contains named slot content Slots PopoverSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // PopoverBuilder provides a fluent API for constructing PopoverProps type PopoverBuilder struct { props PopoverProps } // NewPopover creates a new builder for wa-popover func NewPopover() *PopoverBuilder { return &PopoverBuilder{} } // Placement sets the placement attribute // The preferred placement of the popover. Note that the actual placement may vary as needed to keep the popover func (b *PopoverBuilder) Placement(v string) *PopoverBuilder { b.props.Placement = v return b } // Open sets the open attribute // Shows or hides the popover. func (b *PopoverBuilder) Open(v bool) *PopoverBuilder { b.props.Open = v return b } // Distance sets the distance attribute // The distance in pixels from which to offset the popover away from its target. func (b *PopoverBuilder) Distance(v float64) *PopoverBuilder { b.props.Distance = v return b } // Skidding sets the skidding attribute // The distance in pixels from which to offset the popover along its target. func (b *PopoverBuilder) Skidding(v float64) *PopoverBuilder { b.props.Skidding = v return b } // For sets the for attribute // The ID of the popover's anchor element. This must be an interactive/focusable element such as a button. func (b *PopoverBuilder) For(v string) *PopoverBuilder { b.props.For = v return b } // WithoutArrow sets the without-arrow attribute // Removes the arrow from the popover. func (b *PopoverBuilder) WithoutArrow(v bool) *PopoverBuilder { b.props.WithoutArrow = v return b } // OnShow sets the handler for wa-show event // Emitted when the popover begins to show. Canceling this event will stop the popover from showing. func (b *PopoverBuilder) OnShow(handler string) *PopoverBuilder { b.props.OnShow = handler return b } // OnAfterShow sets the handler for wa-after-show event // Emitted after the popover has shown and all animations are complete. func (b *PopoverBuilder) OnAfterShow(handler string) *PopoverBuilder { b.props.OnAfterShow = handler return b } // OnHide sets the handler for wa-hide event // Emitted when the popover begins to hide. Canceling this event will stop the popover from hiding. func (b *PopoverBuilder) OnHide(handler string) *PopoverBuilder { b.props.OnHide = handler return b } // OnAfterHide sets the handler for wa-after-hide event // Emitted after the popover has hidden and all animations are complete. func (b *PopoverBuilder) OnAfterHide(handler string) *PopoverBuilder { b.props.OnAfterHide = handler return b } // Attr adds a custom HTML attribute func (b *PopoverBuilder) Attr(name, value string) *PopoverBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *PopoverBuilder) Attrs(attrs templ.Attributes) *PopoverBuilder { 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 *PopoverBuilder) Props() PopoverProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *PopoverBuilder) Build() PopoverProps { return b.props } // Popover renders the wa-popover component templ Popover(props PopoverProps) { { children... } } // PopoverFunc renders with a builder function for inline configuration templ PopoverFunc(fn func(*PopoverBuilder)) { {{ b := NewPopover(); fn(b) }} @Popover(b.Props()) { { children... } } }