Textarea

Multi-line text input for longer responses with auto-resizing.

Textarea fields let users enter multiple lines of text. Good for comments, feedback, descriptions and other longer responses. The field grows automatically as the user types.

Basic Usage

Add a textarea field using the addTextarea() builder method:

app/Models/Survey.php

Available Settings

SettingTypeDescription
placeholderstringPlaceholder text shown when field is empty
min_lengthintegerMinimum number of characters required
max_lengthintegerMaximum number of characters allowed
rowsintegerInitial height of the textarea in rows (default: 5)

Validation

Textarea fields are validated by the TextFieldValidator, sharing the same validation logic as single-line text fields:

Controlling Height

Use the rows() method to set the initial height of the textarea:

The rows setting only controls the initial height. The textarea expands as the user types more content.

Frontend Behavior

  • Auto-expands vertically as content grows (no scrollbar needed)
  • Shows character counter when max_length is set
  • Preserves line breaks and formatting in submissions
  • Respects tab key for indentation (does not navigate to next field)
  • Displays validation errors inline below the textarea

When to Use

Use Textarea For:

  • Comments and feedback
  • Descriptions (50-500 characters)
  • Short essays or responses
  • Multi-line addresses
  • Plain text content

Use Rich Text For:

  • Formatted content (bold, italic, lists)
  • Longer articles or essays
  • Content with links or headings
  • Structured responses
  • HTML output needed