// Code generated by wa-generator. DO NOT EDIT. // Source: Web Awesome wa-textarea package wa import ( "github.com/a-h/templ" ) // Textareas collect data from the user and allow multiple lines of text. // // Web Awesome component: // TextareaProps holds all properties for the wa-textarea component type TextareaProps struct { // The name of the textarea, submitted as a name/value pair with form data. Name string `attr:"name"` // The default value of the form control. Primarily used for resetting the form control. Value string `attr:"value"` // The textarea's size. // Valid values: "small", "medium", "large" Size string `attr:"size"` // The textarea's visual appearance. // Valid values: "filled", "outlined", "filled-outlined" Appearance string `attr:"appearance"` // The textarea's label. If you need to display HTML, use the label slot instead. Label string `attr:"label"` // The textarea's hint. If you need to display HTML, use the hint slot instead. Hint string `attr:"hint"` // Placeholder text to show as a hint when the input is empty. Placeholder string `attr:"placeholder"` // The number of rows to display by default. Rows float64 `attr:"rows"` // Controls how the textarea can be resized. // Valid values: "none", "vertical", "horizontal", "both", "auto" Resize string `attr:"resize"` // Disables the textarea. Disabled bool `attr:"disabled"` // Makes the textarea readonly. Readonly bool `attr:"readonly"` // Makes the textarea a required field. Required bool `attr:"required"` // The minimum length of input that will be considered valid. Minlength float64 `attr:"minlength"` // The maximum length of input that will be considered valid. Maxlength float64 `attr:"maxlength"` // Controls whether and how text input is automatically capitalized as it is entered by the user. // Valid values: "off", "none", "on", "sentences", "words", "characters" Autocapitalize string `attr:"autocapitalize"` // Indicates whether the browser's autocorrect feature is on or off. Autocorrect string `attr:"autocorrect"` // Specifies what permission the browser has to provide assistance in filling out form field values. Refer to Autocomplete string `attr:"autocomplete"` // Indicates that the input should receive focus on page load. Autofocus bool `attr:"autofocus"` // Used to customize the label or icon of the Enter key on virtual keyboards. // Valid values: "enter", "done", "go", "next", "previous", "search", "send" Enterkeyhint string `attr:"enterkeyhint"` // Enables spell checking on the textarea. Spellcheck bool `attr:"spellcheck"` // Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual // Valid values: "none", "text", "decimal", "numeric", "tel", "search", "email", "url" Inputmode string `attr:"inputmode"` // Used for SSR. If you're slotting in a label element, make sure to set this to true. WithLabel bool `attr:"with-label"` // Used for SSR. If you're slotting in a hint element, make sure to set this to true. WithHint bool `attr:"with-hint"` // Events // Emitted when the control loses focus. OnBlur string `attr:"x-on:blur"` // Emitted when an alteration to the control's value is committed by the user. OnChange string `attr:"x-on:change"` // Emitted when the control gains focus. OnFocus string `attr:"x-on:focus"` // Emitted when the control receives input. OnInput string `attr:"x-on:input"` // Emitted when the form control has been checked for validity and its constraints aren't satisfied. OnInvalid string `attr:"x-on:wa-invalid"` // Slots contains named slot content Slots TextareaSlots // Attrs contains additional HTML attributes Attrs templ.Attributes } // TextareaSlots holds named slot content for the component type TextareaSlots struct { // The textarea's label. Alternatively, you can use the label attribute. Label templ.Component // Text that describes how to use the input. Alternatively, you can use the hint attribute. Hint templ.Component } // TextareaBuilder provides a fluent API for constructing TextareaProps type TextareaBuilder struct { props TextareaProps } // NewTextarea creates a new builder for wa-textarea func NewTextarea() *TextareaBuilder { return &TextareaBuilder{} } // Name sets the name attribute // The name of the textarea, submitted as a name/value pair with form data. func (b *TextareaBuilder) Name(v string) *TextareaBuilder { b.props.Name = v return b } // Value sets the value attribute // The default value of the form control. Primarily used for resetting the form control. func (b *TextareaBuilder) Value(v string) *TextareaBuilder { b.props.Value = v return b } // Size sets the size attribute // The textarea's size. func (b *TextareaBuilder) Size(v string) *TextareaBuilder { b.props.Size = v return b } // Appearance sets the appearance attribute // The textarea's visual appearance. func (b *TextareaBuilder) Appearance(v string) *TextareaBuilder { b.props.Appearance = v return b } // Label sets the label attribute // The textarea's label. If you need to display HTML, use the label slot instead. func (b *TextareaBuilder) Label(v string) *TextareaBuilder { b.props.Label = v return b } // Hint sets the hint attribute // The textarea's hint. If you need to display HTML, use the hint slot instead. func (b *TextareaBuilder) Hint(v string) *TextareaBuilder { b.props.Hint = v return b } // Placeholder sets the placeholder attribute // Placeholder text to show as a hint when the input is empty. func (b *TextareaBuilder) Placeholder(v string) *TextareaBuilder { b.props.Placeholder = v return b } // Rows sets the rows attribute // The number of rows to display by default. func (b *TextareaBuilder) Rows(v float64) *TextareaBuilder { b.props.Rows = v return b } // Resize sets the resize attribute // Controls how the textarea can be resized. func (b *TextareaBuilder) Resize(v string) *TextareaBuilder { b.props.Resize = v return b } // Disabled sets the disabled attribute // Disables the textarea. func (b *TextareaBuilder) Disabled(v bool) *TextareaBuilder { b.props.Disabled = v return b } // Readonly sets the readonly attribute // Makes the textarea readonly. func (b *TextareaBuilder) Readonly(v bool) *TextareaBuilder { b.props.Readonly = v return b } // Required sets the required attribute // Makes the textarea a required field. func (b *TextareaBuilder) Required(v bool) *TextareaBuilder { b.props.Required = v return b } // Minlength sets the minlength attribute // The minimum length of input that will be considered valid. func (b *TextareaBuilder) Minlength(v float64) *TextareaBuilder { b.props.Minlength = v return b } // Maxlength sets the maxlength attribute // The maximum length of input that will be considered valid. func (b *TextareaBuilder) Maxlength(v float64) *TextareaBuilder { b.props.Maxlength = v return b } // Autocapitalize sets the autocapitalize attribute // Controls whether and how text input is automatically capitalized as it is entered by the user. func (b *TextareaBuilder) Autocapitalize(v string) *TextareaBuilder { b.props.Autocapitalize = v return b } // Autocorrect sets the autocorrect attribute // Indicates whether the browser's autocorrect feature is on or off. func (b *TextareaBuilder) Autocorrect(v string) *TextareaBuilder { b.props.Autocorrect = v return b } // Autocomplete sets the autocomplete attribute // Specifies what permission the browser has to provide assistance in filling out form field values. Refer to func (b *TextareaBuilder) Autocomplete(v string) *TextareaBuilder { b.props.Autocomplete = v return b } // Autofocus sets the autofocus attribute // Indicates that the input should receive focus on page load. func (b *TextareaBuilder) Autofocus(v bool) *TextareaBuilder { b.props.Autofocus = v return b } // Enterkeyhint sets the enterkeyhint attribute // Used to customize the label or icon of the Enter key on virtual keyboards. func (b *TextareaBuilder) Enterkeyhint(v string) *TextareaBuilder { b.props.Enterkeyhint = v return b } // Spellcheck sets the spellcheck attribute // Enables spell checking on the textarea. func (b *TextareaBuilder) Spellcheck(v bool) *TextareaBuilder { b.props.Spellcheck = v return b } // Inputmode sets the inputmode attribute // Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual func (b *TextareaBuilder) Inputmode(v string) *TextareaBuilder { b.props.Inputmode = v return b } // WithLabel sets the with-label attribute // Used for SSR. If you're slotting in a label element, make sure to set this to true. func (b *TextareaBuilder) WithLabel(v bool) *TextareaBuilder { b.props.WithLabel = v return b } // WithHint sets the with-hint attribute // Used for SSR. If you're slotting in a hint element, make sure to set this to true. func (b *TextareaBuilder) WithHint(v bool) *TextareaBuilder { b.props.WithHint = v return b } // OnBlur sets the handler for blur event // Emitted when the control loses focus. func (b *TextareaBuilder) OnBlur(handler string) *TextareaBuilder { b.props.OnBlur = handler return b } // OnChange sets the handler for change event // Emitted when an alteration to the control's value is committed by the user. func (b *TextareaBuilder) OnChange(handler string) *TextareaBuilder { b.props.OnChange = handler return b } // OnFocus sets the handler for focus event // Emitted when the control gains focus. func (b *TextareaBuilder) OnFocus(handler string) *TextareaBuilder { b.props.OnFocus = handler return b } // OnInput sets the handler for input event // Emitted when the control receives input. func (b *TextareaBuilder) OnInput(handler string) *TextareaBuilder { b.props.OnInput = handler return b } // OnInvalid sets the handler for wa-invalid event // Emitted when the form control has been checked for validity and its constraints aren't satisfied. func (b *TextareaBuilder) OnInvalid(handler string) *TextareaBuilder { b.props.OnInvalid = handler return b } // LabelSlot sets the label slot content // The textarea's label. Alternatively, you can use the label attribute. func (b *TextareaBuilder) LabelSlot(c templ.Component) *TextareaBuilder { b.props.Slots.Label = c return b } // HintSlot sets the hint slot content // Text that describes how to use the input. Alternatively, you can use the hint attribute. func (b *TextareaBuilder) HintSlot(c templ.Component) *TextareaBuilder { b.props.Slots.Hint = c return b } // Attr adds a custom HTML attribute func (b *TextareaBuilder) Attr(name, value string) *TextareaBuilder { if b.props.Attrs == nil { b.props.Attrs = templ.Attributes{} } b.props.Attrs[name] = value return b } // Attrs merges multiple attributes func (b *TextareaBuilder) Attrs(attrs templ.Attributes) *TextareaBuilder { 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 *TextareaBuilder) Props() TextareaProps { return b.props } // Build returns the props (alias for Props for semantic clarity) func (b *TextareaBuilder) Build() TextareaProps { return b.props } // Textarea renders the wa-textarea component templ Textarea(props TextareaProps) { if props.Slots.Label != nil {
@props.Slots.Label
} if props.Slots.Hint != nil {
@props.Slots.Hint
} { children... }
} // TextareaFunc renders with a builder function for inline configuration templ TextareaFunc(fn func(*TextareaBuilder)) { {{ b := NewTextarea(); fn(b) }} @Textarea(b.Props()) { { children... } } }