Svelte UI

TextArea Component

Variants

variant tints the border + placeholder (same calc as Input); borderless drops the frame.

Sizes

Basic

Minimum Rows

TextArea enforces a minimum of 2 rows. For single-line input, use the Input component instead.

Copy modes

One exclusive copy prop controls the copy affordance: 'selection' (default — select text to copy, no button), 'button' (also show a copy-to-clipboard button), or 'none' (not copyable / not selectable). Orthogonal to readonly/disabled.

With Validation

Max Rows & Scrollbar

Read-Only

Read-only mode prevents editing but still allows text selection and copying.

Disabled

Props

PropTypeDefaultDescription
valuestring""The textarea value (bindable)
copy'none' | 'selection' | 'button''button'Copy affordance: button, native selection only, or none (not selectable)
validate(value: string) => boolean | stringundefinedValidation function
minRowsnumber3Minimum number of visible rows (enforced minimum: 2)
maxRowsnumber10Maximum number of visible rows
readonlybooleanfalseMakes textarea read-only (prevents editing but allows selection)
disabledbooleanfalseDisables the textarea
classstring""Container CSS class
textareaClassstring""Textarea element CSS class

Lines Array

TextArea

Array Value

Auto-sizing

When maxRows is omitted, the TextArea grows to fit all content without height restrictions.

Try pasting a lot of text to see it expand!

Conflict Handling

⚠️ Development Warnings

The TextArea component shows warnings in development mode for:

  • Prop conflicts: When both value and lines are provided, value takes precedence
  • Empty content: When no value or lines are provided, TextArea will be empty

Content precedence: value > lines