Enter multi-line descriptions, notes, or longer content with native form attributes and field feedback.

How to use

With required, empty submission focuses the first invalid field and briefly pulses its red border, keeping the original ring color. It restores the original state without empty-field text. Reduced motion only focuses the field. Browser bubbles are suppressed while invalid submissions remain blocked. Nonempty format and business errors retain text; editing or reset clears feedback.

Native validation failures suppress browser bubbles and still block invalid submission. Empty required fields only pulse a red border briefly, show no text, and return to their original state. Nonempty type, length, and format errors display validationMessage below the component. Focus goes to the first invalid field; editing updates feedback and reset clears it. Business validation uses invalid and error; native errors take precedence. Native message language is controlled by the browser. Client validity does not imply server acceptance.

Use Textarea for multiple lines of text; use Input for one line. Compose it with Field for a label, help, and error. Do not use a read-only input as a layout substitute for ordinary display text.

  • bind:value synchronizes text. defaultValue is only a fallback when value is undefined. Restore the bound value on form reset.

  • resize controls allowed directions. readonly, disabled, or resize="none" removes the resize handle. name participates in form submission.

Import

import { Textarea } from '@snowui-design-system/components';

Usage

Draft

Feedback form

Character count

Input limit

Readonly

Disabled

Resize

Long content

Address

Loading

Events

API Reference

Property Type Default Example Description
value string — bind:value={draft} Current text; supports bind:value. An explicit value takes priority over defaultValue. On input and change, the binding is synchronized before the corresponding callback runs.
defaultValue string — defaultValue="SnowUI release notes" Fallback text while value is undefined; value takes over after the first edit. This is not an independent native reset protocol. Controlled forms should restore the bound initial value in onreset.
placeholder string — placeholder="Share feedback on the docs…" Multiline hint for an empty value; may include line breaks. It does not replace an accessible label.
maxCount number — maxCount={100} Suggested character limit used only by the counter and exceeded; it does not block input. Counts JavaScript string.length (UTF-16 code units). The counter appears on component hover instead of using an 80% threshold, and stays red and visible only when strictly over the limit. Use a positive integer. Set maxlength separately for a hard input limit.
exceeded boolean false bind:exceeded={exceeded} Calculated automatically from whether current text length is strictly greater than maxCount. Supports bind:exceeded for reading the result. False when maxCount is absent; a supplied value is overwritten by the calculation. Does not automatically set invalid.
name string — name="feedback" Native form field name for submission. Disabled fields are excluded from FormData.
disabled boolean false disabled Disable editing, native form submission, and Tab focus, and remove the resize handle while keeping content visible.
readonly boolean false readonly Preserve focus, selection, copy, and named form submission while preventing edits. Removes the resize handle, ignores rows, and uses a read-only content layout.
required boolean false required Participates in native required validation. Empty submission briefly pulses the red border without text, then restores the original state and keeps the focus ring color.
rows number 2 rows={6} Suggested visible row count passed to the native textarea; use a positive integer. Not passed when readonly. The component also measures content height on mount, input, and external value changes, so rows does not lock the final height.
cols number — cols={32} Suggested character column count passed to the native textarea; use a positive integer. The component fills container width by default, so cols does not directly set shell width. With wrap="hard", it can affect submitted line breaks.
minlength number — minlength={20} Native minimum text length in UTF-16 code units. Does not block input. Use required separately for empty values. Native invalid events automatically feed the component error state.
maxlength number — maxlength={100} Native maximum input length in UTF-16 code units. Browsers usually stop further user input, but do not truncate externally assigned value or defaultValue. Separate from maxCount, which controls the counter hint.
wrap HTMLTextareaAttributes["wrap"] — <Textarea wrap="soft" /> <Textarea wrap="hard" cols={32} /> <Textarea wrap="off" /> Native line-wrap policy: soft wraps visually without adding submission line breaks; hard can add submission line breaks based on column width; off does not wrap automatically. Browser default is soft. The component has no horizontal scrollbar, so soft is preferable for editing long lines.
spellcheck boolean — spellcheck={false} Browser spellcheck setting. When omitted, browser and inherited settings apply; the browser provides the dictionary.
autocomplete HTMLTextareaAttributes["autocomplete"] — autocomplete="street-address" Native autofill hint, such as street-address. Suggestions depend on browser-saved data and are not supplied by the component.
enterkeyhint HTMLTextareaAttributes["enterkeyhint"] — enterkeyhint="done" Mobile Enter-key label hint, such as done, enter, or next. It does not submit or navigate. The keyboard decides its presentation.
inputmode HTMLTextareaAttributes["inputmode"] — inputmode="text" Soft-keyboard mode hint, such as text or numeric. It does not change the string value type or validate the format.
form string — form="feedback-form" Associate a native form in the same document by id, allowing a textarea outside that form’s DOM subtree to participate in submission.
autofocus boolean — autofocus Native textarea autofocus request. The browser decides whether it runs. Prefer using it when the user actively opens an editing region.
tabindex number — tabindex={0} Native Tab order. 0 uses natural order, -1 skips sequential navigation but allows programmatic focus, and a positive number sets priority. Natural order is recommended for ordinary forms.
title string — title="Review comment" Native hint text. The browser decides how to display it; it does not replace a visible label or error.
id string — id="documentation-feedback" id of the internal native textarea for label for and ARIA references. Keep it unique within a document.
resize "none" | "vertical" | "horizontal" | "both" "both" resize="both" Allowed resize direction: none hides the handle; vertical changes height; horizontal changes width; both changes both. readonly and disabled force none. The handle has default minimum width 120px and height 60px. After manual height adjustment, automatic content-height measurement stops.
invalid boolean false invalid Business error state combined with aria-invalid and native validation feedback. Setting this prop alone does not validate or move focus. maxCount does not trigger native validation. Field owns the combined visual feedback when embedded.
error string — error="Example" Business error text displayed below the textarea with invalid. Native validation feedback is automatic.
parts ComponentPartsOf<{ Indicator: typeof Indicator }> — parts={{ Indicator: { step: 4, maxHeight: 160 } }} Configure the built-in Indicator, including keyboard step or largeStep, maxWidth or maxHeight bounds, and ariaLabel. Applies only to the generated handle; none exists when resize=none, readonly, or disabled.
onclick (event: MouseEvent) => void — onclick={record} Called on click on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
ondblclick (event: MouseEvent) => void — ondblclick={record} Called on double-click on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
oninput (event: Event) => void — oninput={record} Called when user input changes content, after the bound value has been synchronized on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onchange (event: Event) => void — onchange={record} Called when a user commits an edited value, usually on blur, after the bound value has been synchronized on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onfocus (event: FocusEvent) => void — onfocus={record} Called on focus on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onblur (event: FocusEvent) => void — onblur={record} Called on blur on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onkeydown (event: KeyboardEvent) => void — onkeydown={record} Called on keydown; the event exposes key and related fields on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onkeyup (event: KeyboardEvent) => void — onkeyup={record} Called on keyup on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onkeypress (event: KeyboardEvent) => void — onkeypress={record} Called on the deprecated keypress event; prefer onkeydown in new code on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
onpaste (event: ClipboardEvent) => void — onpaste={record} Called on paste; clipboardData can read the pasted content on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
oncopy (event: ClipboardEvent) => void — oncopy={record} Called on copy; clipboardData can set the copied content on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
oncut (event: ClipboardEvent) => void — oncut={record} Called on cut; clipboardData can set the cut content on the internal native textarea. Receives the native event with currentTarget set to that textarea. The return value is ignored; call event.preventDefault() to cancel a cancelable browser default action.
No data