Textarea

Multi-line text input component with two-way binding.

The Textarea component provides a multi-line text input for longer content like descriptions, comments, or messages.

Installation

bash
shellui add textarea

Usage

Basic

<div class="w-full max-w-sm">
  <Textarea Placeholder="Enter your message..." />
</div>

With Label

<div class="w-full max-w-sm space-y-2">
  <Label>Message</Label>
  <Textarea Placeholder="Enter your message..." />
</div>

Two-way Binding

<div class="w-full max-w-sm">
  <Textarea @bind-Value="message" Placeholder="Enter your message..." />
</div>

@code {
    private string message = "";
}

ValueChanged Callback

<div class="w-full max-w-sm">
  <Textarea Value="@message" ValueChanged="@HandleChanged" Placeholder="Enter your message..." />
</div>

@code {
    private string message = "";

    private void HandleChanged(string value)
    {
        message = value;
    }
}

Disabled and ReadOnly

<div class="w-full max-w-sm">
  <Textarea Placeholder="Disabled textarea" Disabled="true" />
  <Textarea Value="This is read-only content" ReadOnly="true" />
</div>

With Character Count

0 / 500 characters

<div class="w-full max-w-sm space-y-2">
  <Textarea @bind-Value="message" Placeholder="Enter your message..." />
  <p class="text-sm text-muted-foreground">@message.Length / 500 characters</p>
</div>

@code {
    private string message = "";
}

API Reference

Parameter Type Default Description
Variant InputVariant Default Default or Error, as on Input
Value string "" Current textarea value
Placeholder string "" Placeholder text
Disabled bool false Disables the textarea
ReadOnly bool false Makes textarea read-only
Class string? null Additional CSS classes
ValueChanged EventCallback<string> — Fires when value changes
OnFocus EventCallback<FocusEventArgs> — Fires when the textarea gains focus
OnBlur EventCallback<FocusEventArgs> — Fires when the textarea loses focus

The CLI template has Variant, ReadOnly, OnFocus and OnBlur from 0.4.0-alpha.3; its styles come from the textarea-variants template, installed with it.

Accessibility

  • Proper label association via For / Id attributes
  • Keyboard navigation support
  • Screen reader compatible

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.