Textarea
A multi-line text field that can grow with its content.
On this page
Examples
Textarea
Razor
<div class="flex w-full max-w-sm flex-col gap-3">
<KlyTextarea Placeholder="Write a message…" aria-label="Message" />
<KlyTextarea Placeholder="Grows with its content" AutoResize Variant="FieldVariant.Subtle" Rows="2" aria-label="Notes" />
</div>API
KlyTextarea
Multi-line text input that binds to a string and can resize itself to its content.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
AutoResize |
bool |
false |
Grow with the content (CSS field-sizing, where the browser supports it). |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Color |
KlyColor |
"primary" |
Semantic color of the control: a built-in KlyColor or the name of a color you defined. When not set, Color applies, else primary. Values: primary, secondary, success, info, warning, error, neutral. |
Disabled |
bool |
false |
Disables the control: it cannot be focused or changed and is not submitted. |
Id |
string |
The id of the native control. Defaults to the one of the enclosing KlyFormField , else a generated one. | |
Immediate |
bool |
false |
Update the bound value on every keystroke instead of on change. Costs a round trip per key in Server mode. |
Name |
string |
Form field name outside an EditForm . Inside one, the name comes from the bound expression. | |
Placeholder |
string |
Hint shown while the field is empty. | |
Required |
bool |
false |
Marks the control as required, for the browser and for assistive technology. |
Rows |
int |
3 |
Number of visible lines when the field is empty. Defaults to 3. |
Size |
KlySize? |
Defaults to the size of the enclosing KlyFormField , or medium. Values: Xs, Sm, Md, Lg, Xl. |
|
Ui |
TextareaUi |
Per-instance class overrides of the slots of the textarea, see TextareaUi . They are merged after the theme and the Class parameter wins on the root slot. | |
Value (@bind-Value) |
string |
The value of the control. Bind it with @bind-Value . | |
ValueExpression |
Expression |
The expression of the bound field. The compiler sets it with @bind-Value , and validation uses it to find the field. | |
Variant |
FieldVariant |
FieldVariant. |
Look of the field: Outline , Soft , Subtle , Ghost or None . Values: Outline, Soft, Subtle, Ghost, None. |
Ui slots
Ui takes a TextareaUi with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Base |
Classes merged into the base slot of KlyTextarea , after the theme and the app configuration. |