Skip to content

Textarea

STextarea is a multi-line text field. It is built on SFormField (the same composition as SInput): the label, hint/error message and a11y wiring are reused. It works with v-model.

The label floats by default (at rest it sits on the first line, on focus or once filled it moves up onto the top border); turn it off with :floating-label="false".

Basic usage

Hint and error

A few words about yourself
Fill in the field

States

required marks the field as required (* next to the label), invalid marks the field as invalid, disabled dims the field and blocks input.

prepend / append slots

The slots put arbitrary content inside the field border — an icon or a button.

Read-only

readonly shows the text and lets the user select and copy it but not change it: unlike disabled, the field is not dimmed and stays in the tab order.

API

Props

NameTypeDefaultDescription
size"md" | "sm" | "lg""md"Field size: affects the font and inner padding (height comes from rows/resizing).
idstringundefinedField id. Generated automatically when not set (SSR-safe).
labelstringundefinedField label.
floating-labelbooleantrueFloating label: the label sits inside the border (at rest, at the first line, like a placeholder) and floats up to the top edge on focus or when filled. On by default; false renders a regular label above the field. The label size is fixed and does not depend on size.
hintstringundefinedHint below the field.
errorstringundefinedError message. When set, the field is marked invalid.
invalidbooleanfalseExplicitly marks the field invalid (in addition to error).
readonlybooleanundefinedRead-only field: the text is visible and selectable but cannot be edited.
squarebooleanundefinedSquare corners: removes the field border radius (rounded by default).
requiredbooleanfalseRequired field: adds a * marker to the label.
placeholderstringundefinedPlaceholder text in an empty field.
disabledbooleanfalseDisables input and makes the field inactive.
rowsnumber3Number of visible rows (the default height).
model-valuestringundefinedField value. Two-way bound via v-model.

Events

NameSignatureDescription
update:modelValue(value: string | undefined) => voidEmitted when modelValue changes. Used for two-way binding (v-model).

Slots

NameDescription
prependContent at the start of the field, inside the border (icon, button).
appendContent at the end of the field, inside the border (icon, button).