// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-format-bytes package wa import ( "github.com/a-h/templ" ) // Formats a number as a human readable bytes value. // // Web Awesome component: // FormatBytesProps holds all properties for the wa-format-bytes component type FormatBytesProps struct { // The number to format in bytes. Value float64 `attr:"value"` // The type of unit to display. // Valid values: "byte", "bit" Unit string `attr:"unit"` // Determines how to display the result, e.g. "100 bytes", "100 b", or "100b". // Valid values: "long", "short", "narrow" Display string `attr:"display"` // Events // Slots contains named slot content Slots FormatBytesSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // FormatBytesBuilder provides a fluent API for constructing FormatBytesProps type FormatBytesBuilder struct { props FormatBytesProps } // NewFormatBytes creates a new builder for wa-format-bytes func NewFormatBytes() *FormatBytesBuilder { return &FormatBytesBuilder{} } // Value sets the value attribute // The number to format in bytes. func (b *FormatBytesBuilder) Value(v float64) *FormatBytesBuilder { b.props.Value = v return b } // Unit sets the unit attribute // The type of unit to display. func (b *FormatBytesBuilder) Unit(v string) *FormatBytesBuilder { b.props.Unit = v return b } // Display sets the display attribute // Determines how to display the result, e.g. "100 bytes", "100 b", or "100b". func (b *FormatBytesBuilder) Display(v string) *FormatBytesBuilder { b.props.Display = v return b } // Attr adds a custom HTML attribute func (b *FormatBytesBuilder) Attr(name, value string) *FormatBytesBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *FormatBytesBuilder) Attrs(attrs templ.Attributes) *FormatBytesBuilder { 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 *FormatBytesBuilder) Props() FormatBytesProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *FormatBytesBuilder) Build() FormatBytesProps { return b.props } // FormatBytes renders the wa-format-bytes component templ FormatBytes(props FormatBytesProps) { { children... } } // FormatBytesFunc renders with a builder function for inline configuration templ FormatBytesFunc(fn func(*FormatBytesBuilder)) { {{ b := NewFormatBytes(); fn(b) }} @FormatBytes(b.Props()) { { children... } } }