Textarea
DTextarea wraps DInput.
Sizes— textarea-xs to textarea-lg
<DTextarea Size="DaisySize.ExtraSmall" Rows="2" Placeholder="Extra small" />
<DTextarea Size="DaisySize.Small" Rows="2" Placeholder="Small" />
<DTextarea Size="DaisySize.Medium" Rows="2" Placeholder="Medium" />
<DTextarea Size="DaisySize.Large" Rows="2" Placeholder="Large" />Colors
<DTextarea Color="DaisyColor.Primary" Rows="2" Placeholder="Primary" />
<DTextarea Color="DaisyColor.Secondary" Rows="2" Placeholder="Secondary" />
<DTextarea Color="DaisyColor.Accent" Rows="2" Placeholder="Accent" />
<DTextarea Color="DaisyColor.Error" Rows="2" Placeholder="Error" />Resizable— Resize parameter - default Both beats Tailwind's resize: vertical preflight
<DTextarea Rows="3" Resize="DaisyResize.Both" Value="Drag any corner - both directions" />
<DTextarea Rows="3" Resize="DaisyResize.Vertical" Value="Vertical only (Tailwind default)" />
<DTextarea Rows="3" Resize="DaisyResize.Horizontal" Value="Horizontal only - drag the bottom edge" />
<DTextarea Rows="3" Resize="DaisyResize.None" Value="Not resizable" />Interactive binding
0 chars
<DTextarea Label="Release notes" Rows="4" Placeholder="What changed?" @bind-Value="_notes" />
<p class="mt-3 text-sm opacity-70">
<span class="badge badge-outline badge-sm">@(_notes?.Length ?? 0) chars</span>
@if (!string.IsNullOrWhiteSpace(_notes))
{
<span class="badge badge-primary badge-sm ml-2">@(_notes.Split('\n').Length) lines</span>
}
</p>
@code {
private string? _notes;
}Tips
Rows maps to the nativerows attribute.Resize emits an inlineresize declaration; Tailwind's preflight would otherwise pin every textarea to vertical-only resizing.- Inside an
EditForm , invalid fields automatically gettextarea-error . - Add
Validator="true" plus a siblingDValidatorfor CSS-only messages that work even in static SSR.
API
DTextarea
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Rows | int? | — | — | Number of visible text lines (native rows attribute). |
| Placeholder | string | — | — | Placeholder text shown when empty. |
| Label | string | — | — | Optional label rendered above the textarea. |
| Color | DaisyColor | Default | — | daisyUI color (textarea-primary, textarea-error, ...). DefaultPrimarySecondaryAccentInfoSuccessWarningErrorGhostNeutral |
| Size | DaisySize | Medium | — | Sizes the textarea (textarea-xs ... textarea-lg). ExtraSmallSmallMediumLargeExtraLarge |
| Disabled | bool | False | — | Disables the textarea. |
| Validator | bool | False | — | Adds daisyUI's validator class (see DValidator ). |
| Resize | DaisyResize | Both | — | Which directions the user can drag to resize the textarea. Defaults to Both — Tailwind's preflight restricts every <textarea> to resize: vertical , so we emit an inline resize declaration to restore full resizing. NoneBothHorizontalVertical |
| Class | string | — | — | — |
| Style | string | — | — | — |
| Value | string | — | @bind-Value | — |
| ValueExpression | Expression<Func<string>> | — | — | — |
| DisplayName | string | — | — | — |