Skip to content

Textarea

A multi-line text input for longer content — comments, messages, descriptions. Supports validation states, disabled, and an actions variant.

Default Rendered example
Usage Example
@textarea.Textarea(textarea.Config{
    ID:          "comment",
    Name:        "comment",
    Label:       "Comment",
    Placeholder: "We'd love to hear from you...",
    Rows:        3,
})

Required

Required: true emits the native required attribute for browser validation.

Required Rendered example
Required before this review can be submitted.
Required
@textarea.Textarea(textarea.Config{
    ID:       "review-note",
    Name:     "review_note",
    Label:    "Review note",
    Required: true,
})

Error State

State: textarea.StateError recolors the border and HelperText for validation errors.

Error State Rendered example
Error: Please add some comments to your evaluation
Error State
@textarea.Textarea(textarea.Config{
    ID:         "comment-error",
    Name:       "comment",
    Label:      "Comment",
    State:      textarea.StateError,
    HelperText: "Error: Please add some comments to your evaluation",
    Rows:       3,
})

Success State

State: textarea.StateSuccess applies the success styling.

Success State Rendered example
Success State
@textarea.Textarea(textarea.Config{
    ID:    "comment-success",
    Name:  "comment",
    Label: "Comment",
    State: textarea.StateSuccess,
    Rows:  3,
})

Disabled

Disabled: true blocks editing and dims the field.

Disabled Rendered example
Disabled
@textarea.Textarea(textarea.Config{
    ID:          "comment-disabled",
    Name:        "comment",
    Label:       "Comment",
    Placeholder: "This textarea is disabled",
    Disabled:    true,
})

With Actions

textarea.TextareaWithActions wraps the field with a toolbar/footer for inline actions.

With Actions Rendered example
With Actions
@textarea.TextareaWithActions(textarea.Config{
    ID:          "message",
    Name:        "message",
    Placeholder: "Type your message here...",
    Rows:        6,
})

Go API

v0.2.7

The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.

github.com/araihu/goshtoso/components/textarea
Open v0.2.7 API