Examples
- Basic Usage
- With Icons & Affixes
- Input Types
- Error States

Basic text field with different states and features.
Properties
Required
The controller for the text field that manages the text being edited.
Content
The label text displayed above the text field.
The placeholder text shown when the field is empty.
Additional descriptive text displayed below the field. Useful for providing context or input requirements.
Text displayed at the beginning of the input area (e.g., ”€”, “https://”).
Text displayed at the end of the input area (e.g., “.com”, “kg”).
An optional icon displayed at the beginning of the field. Use
PhosphorIconsRegular.iconName
.Layout
Whether the text field should display a border. When false, creates a borderless input suitable for inline editing.
Whether the text field should have internal padding. When false, removes padding for custom layouts.
Input Configuration
The type of keyboard to display for text input (e.g.,
TextInputType.emailAddress
, TextInputType.phone
).Optional input formatters to restrict or modify input (e.g., length limits, character filters).
Hints for autofill services to provide appropriate suggestions (e.g.,
[AutofillHints.email]
).Whether to hide the text being entered. Typically used for password fields.
State
Error message to display below the field. When provided, the field appears in an error state with red styling. To remove the error, set this to
null
.Focus node for managing focus state programmatically. When not provided, the widget creates its own internal focus node.
Controls whether the text field is interactive. When
false
, the field dims, ignores input and focus, and shows a forbidden cursor.Callbacks
Callback function called whenever the text changes. Receives the current text value.
Callback function called when the user submits the text (e.g., pressing Enter). Receives the current text value.
Whether to keep focus on the field after submission. Useful for forms where users might submit multiple times (e.g. a chat input).
Best Practices
- Width Constraints: Always provide width constraints to prevent layout issues by wrapping in
ConstrainedBox
,SizedBox
,Expanded
, etc. - Input Types: Always set appropriate
keyboardType
andautofillHints
for better user experience on mobile devices. - Placeholders: Use placeholder text to show examples or provide additional context about the expected input format.
Integration Notes
- Focus Management: The text field automatically handles focus states and provides visual feedback when active.