Skip to content

Text Area

A customizable text area component that provides a consistent way to collect multiline user input through expandable text fields.

The Text Area is built using the InputField component with multiline configuration. It offers various styling options and input behaviors, supporting features like validation, placeholder text, and expandable height. It handles different states including focus, error, and disabled states, making it perfect for collecting longer text content like notes, comments, or descriptions.


A simple text area with placeholder text that expands as the user types.


Text area in a non-interactive state, preventing user input.


Text area with validation that displays error messages when content is invalid.


PropertyTypeDescription
controllerTextEditingController?Controller for the text area input.
minLinesint?Minimum number of lines to display. Determines the initial height of the text area.
maxLinesint?Maximum number of lines to display. The text area will expand up to this limit.
hintTextString?Placeholder text displayed when the text area is empty.
hintStyleTextStyle?Style for the hint text when the text area is empty.
textInputTypeTextInputType?Set to TextInputType.multiline for text area functionality.
validatorString? Function(String?)?Function that validates the text and returns an error message string if invalid.
enabledbool?Controls whether the text area is interactive or grayed out.
maxLengthint?Maximum number of characters allowed in the text area.
autovalidateModeAutovalidateMode?Determines when validation should be performed (e.g., on user interaction, always).
contentPaddingEdgeInsetsGeometry?Custom padding for the content inside the text area.
fillColorColor?Background color of the text area.
borderBoxBorder?Custom border for the text area. Overrides the default border.
borderRadiusBorderRadiusGeometryCorner radius for the text area borders.
initialValueString?Default text to display when the text area is first created.
onChangedvoid Function(String)?Callback function when the text value changes.
focusNodeFocusNode?Focus node that controls the focus state of this text area.
autofocusboolWhen true, the text area will be focused when the widget is first created.
textInputActionTextInputAction?Determines the action button on the keyboard (e.g., newline, done).
onSubmitiedValueChanged<String>?Callback function when the user submits the text area.

  • Set minLines to define the initial height of the text area
  • Use maxLines to prevent the text area from growing too large
  • Always set textInputType: TextInputType.multiline for proper multiline behavior
  • Consider adding validation for required fields or content length limits
  • Use appropriate textInputAction values like TextInputAction.newline for multiline input