// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-qr-code package wa import ( "github.com/a-h/templ" ) // Generates a QR code and renders it using the Canvas API. // // Web Awesome component: // QrCodeProps holds all properties for the wa-qr-code component type QrCodeProps struct { // The QR code's value. Value string `attr:"value"` // The label for assistive devices to announce. If unspecified, the value will be used instead. Label string `attr:"label"` // The size of the QR code, in pixels. Size float64 `attr:"size"` // The fill color. This can be any valid CSS color, but not a CSS custom property. Fill string `attr:"fill"` // The background color. This can be any valid CSS color or transparent. It cannot be a CSS custom property. Background string `attr:"background"` // The edge radius of each module. Must be between 0 and 0.5. Radius float64 `attr:"radius"` // The level of error correction to use. Learn more // Valid values: "L", "M", "Q", "H" ErrorCorrection string `attr:"error-correction"` // Events // Slots contains named slot content Slots QrCodeSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // QrCodeBuilder provides a fluent API for constructing QrCodeProps type QrCodeBuilder struct { props QrCodeProps } // NewQrCode creates a new builder for wa-qr-code func NewQrCode() *QrCodeBuilder { return &QrCodeBuilder{} } // Value sets the value attribute // The QR code's value. func (b *QrCodeBuilder) Value(v string) *QrCodeBuilder { b.props.Value = v return b } // Label sets the label attribute // The label for assistive devices to announce. If unspecified, the value will be used instead. func (b *QrCodeBuilder) Label(v string) *QrCodeBuilder { b.props.Label = v return b } // Size sets the size attribute // The size of the QR code, in pixels. func (b *QrCodeBuilder) Size(v float64) *QrCodeBuilder { b.props.Size = v return b } // Fill sets the fill attribute // The fill color. This can be any valid CSS color, but not a CSS custom property. func (b *QrCodeBuilder) Fill(v string) *QrCodeBuilder { b.props.Fill = v return b } // Background sets the background attribute // The background color. This can be any valid CSS color or transparent. It cannot be a CSS custom property. func (b *QrCodeBuilder) Background(v string) *QrCodeBuilder { b.props.Background = v return b } // Radius sets the radius attribute // The edge radius of each module. Must be between 0 and 0.5. func (b *QrCodeBuilder) Radius(v float64) *QrCodeBuilder { b.props.Radius = v return b } // ErrorCorrection sets the error-correction attribute // The level of error correction to use. Learn more func (b *QrCodeBuilder) ErrorCorrection(v string) *QrCodeBuilder { b.props.ErrorCorrection = v return b } // Attr adds a custom HTML attribute func (b *QrCodeBuilder) Attr(name, value string) *QrCodeBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *QrCodeBuilder) Attrs(attrs templ.Attributes) *QrCodeBuilder { 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 *QrCodeBuilder) Props() QrCodeProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *QrCodeBuilder) Build() QrCodeProps { return b.props } // QrCode renders the wa-qr-code component templ QrCode(props QrCodeProps) { { children... } } // QrCodeFunc renders with a builder function for inline configuration templ QrCodeFunc(fn func(*QrCodeBuilder)) { {{ b := NewQrCode(); fn(b) }} @QrCode(b.Props()) { { children... } } }