TextArea

Textarea for multi-line text input with auto-grow functionality and hint support.

Usage

<%= form_with url: root_path do |f| %>
  <%= f.text_area :bio %>
  <%= f.text_area :comment, rows: 5 %>
<% end %>
Props
PropTypeDefaultDescription
rowsInteger3Number of visible text lines.
labelString | falsehumanized attribute nameCustom label text. Set to `false` to hide the label.
hintStringnilHelper text displayed below the field.
errorStringnilManual error message. ActiveRecord errors are displayed automatically.
disabledBooleanfalseDisable the field.

Also accepts any HTML attributes via **options (e.g., id:, data:, aria:). class: is also supported for custom styling.

Examples

Basic Text Area

<%= form_with url: root_path do |f| %>
  <%= f.text_area :bio %>
  <%= f.text_area :comment, placeholder: "5 rows by default", rows: 5 %>
<% end %>

Label customization

<%= form_with url: root_path do |f| %>
  <%= f.text_area :custom_label, label: "Custom Label Text" %>
  <%= f.text_area :no_label, label: false, placeholder: "Field without label" %>
<% end %>

Hint message

Max 500 characters

<%= form_with url: root_path do |f| %>
  <%= f.text_area :bio, hint: "Max 500 characters" %>
<% end %>

Disabled State

<%= form_with url: root_path do |f| %>
  <%= f.text_area :disabled_field, value: "This text area is disabled", disabled: true %>
<% end %>

Validation

Is required

This field has a custom error

<% user = User.new %>
<% user.errors.add(:bio, "is required") %>
<%= form_with model: user, url: root_path do |f| %>
  <%= f.text_area :bio, label: "Active Record Validations" %>
  <%= f.text_area :manual_error_field, error: "This field has a custom error", value: "Invalid Value" %>
<% end %>