package examples import "github.com/axadrn/shadcn-templ/v2/components/textarea"package examples import "github.com/axadrn/shadcn-templ/v2/components/textarea" templ TextareaDemo() { @textarea.Textarea(textarea.Props{Placeholder: "Type your message here."})}Installation
Usage
Field
Use Field, FieldLabel, and FieldDescription to create a textarea with a label and description.
Enter your message below.
package examples import (package examples import ( "github.com/axadrn/shadcn-templ/v2/components/field" "github.com/axadrn/shadcn-templ/v2/components/textarea") templ TextareaField() { @field.Field() { @field.Label(field.LabelProps{For: "textarea-message"}) { Message } @field.Description() { Enter your message below. } @textarea.Textarea(textarea.Props{ ID: "textarea-message", Placeholder: "Type your message here.", }) }}Disabled
Use the Disabled prop to disable the textarea. To style the disabled state, set Disabled on the field.Field component.
package examples import (package examples import ( "github.com/axadrn/shadcn-templ/v2/components/field" "github.com/axadrn/shadcn-templ/v2/components/textarea") templ TextareaDisabled() { @field.Field(field.Props{Attributes: templ.Attributes{"data-disabled": "true"}}) { @field.Label(field.LabelProps{For: "textarea-disabled"}) { Message } @textarea.Textarea(textarea.Props{ ID: "textarea-disabled", Placeholder: "Type your message here.", Disabled: true, }) }}Invalid
Use aria-invalid to mark the textarea as invalid. To style the invalid state, set Invalid on the field.Field component.
Please enter a valid message.
package examples import (package examples import ( "github.com/axadrn/shadcn-templ/v2/components/field" "github.com/axadrn/shadcn-templ/v2/components/textarea") templ TextareaInvalid() { @field.Field(field.Props{Attributes: templ.Attributes{"data-invalid": "true"}}) { @field.Label(field.LabelProps{For: "textarea-invalid"}) { Message } @textarea.Textarea(textarea.Props{ ID: "textarea-invalid", Placeholder: "Type your message here.", Attributes: templ.Attributes{"aria-invalid": "true"}, }) @field.Description() { Please enter a valid message. } }}Button
Pair with Button to create a textarea with a submit button.
package examples import (package examples import ( "github.com/axadrn/shadcn-templ/v2/components/button" "github.com/axadrn/shadcn-templ/v2/components/textarea") templ TextareaButton() { <div class="grid w-full gap-2"> @textarea.Textarea(textarea.Props{Placeholder: "Type your message here."}) @button.Button() { Send message } </div>}API Reference
Textarea
The Textarea component renders a native textarea element.