Skip to content

Textarea

Drag the corner to resize.

Your bio is ready to submit.

A styled, multi-line native <textarea> — user-resizable (vertical), with the same label, description, error and success wiring as TextField. It participates in native forms through name. Use this (not TextField) whenever the input can span multiple lines.

<script>
import Textarea from "@invisible-ui/svelte/Textarea.svelte";
</script>

maxlength, minlength, autocomplete and spellcheck reach the real <textarea>, so the browser enforces and reports them itself.

<Textarea label="Message" maxlength={280} minlength={10} />
PropTypeDefaultDescription
label *string—Visible label, tied to the control.
hideLabelbooleanfalseVisually hide the label while keeping it as the accessible name. The label text is always required.
valuestring""Field value.
placeholderstring | undefinedundefinedPlaceholder text.
rowsnumber3Visible text rows.
descriptionstring | undefinedundefinedHint shown under the control, linked via aria-describedby.
errorstring | undefinedundefinedWhen non-empty the field becomes invalid and announces the message.
successstring | undefinedundefinedSuccess/validated message; shows a confirming caption.
disabledbooleanfalseDisable the field.
requiredbooleanfalseMark as required.
readOnlybooleanfalseMake the field read-only.
namestring | undefinedundefinedForm field name — the value is submitted under it.
autocompleteHTMLTextareaAttributes["autocomplete"] | undefinedundefinedNative textarea autocomplete hint.
maxlengthnumber | undefinedundefinedNative length limits; the browser enforces them and reports them.
minlengthnumber | undefinedundefined
spellcheckboolean | undefinedundefinedTurn spelling correction off for codes and identifiers.
onValueChange((value: string) => void) | undefinedundefinedCalled whenever the value changes.
  • Label association plus aria-describedby (hint, error and success), aria-invalid, aria-required come from the shared headless text field.
  • A non-empty error puts the field in the invalid state and announces the message.
  • Error and success messages include a decorative status glyph, so feedback is not conveyed by color alone.
  • When both error and success are supplied, the error wins.
<Textarea
label="Message"
name="message"
autocomplete="off"
rows={5}
onValueChange={(v) => (message = v)}
/>

In React, the native attributes take their React spelling (maxLength, minLength, autoComplete, spellCheck). A form reset restores the current value without calling onValueChange:

<Textarea label="Message" name="message" rows={5} value={message} onValueChange={setMessage} />

Themeable via --ds-field-*.