Skip to content

Input Field

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

The InputField component offers various styling options and input behaviors, supporting features like floating labels, placeholder text, validation, and icon decorations. It handles different states including focus, error, and disabled states, making it versatile for various form input needs.


Basic input field with placeholder text and validation.


Input field with a floating label that animates when focused.


Input field with a leading icon.


Input field with a trailing icon.


Input field with both leading and trailing icons.


Input field in a non-interactive state.


PropertyTypeDescription
controllerTextEditingController?Controller for the text field input.
isPasswordboolWhen true, obscures the text being edited (for password fields).
autofocusboolWhen true, the text field will be focused when the widget is first created.
labelTextString?Text displayed as a floating label above the text field when focused or filled.
hintTextString?Placeholder text displayed when the text field is empty.
hintStyleTextStyle?Style for the hint text when the text field is empty.
textInputTypeTextInputType?The type of keyboard to use for editing the text (e.g., email, number, phone).
onSubmitiedValueChanged<String>?Callback function when the user submits the text field (e.g., presses done/next).
validatorString? Function(String?)?Function that validates the text and returns an error message string if invalid.
textInputActionTextInputAction?Determines the action button on the keyboard (e.g., next, done, search).
suffixIconWidget?Widget displayed at the end of the text field, typically for action buttons.
enabledbool?Controls whether the text field is interactive or grayed out.
maxLengthint?Maximum number of characters allowed in the text field.
autovalidateModeAutovalidateMode?Determines when validation should be performed (e.g., on user interaction, always).
prefixIconWidget?Widget displayed at the start of the text field, typically for icons.
contentPaddingEdgeInsetsGeometry?Custom padding for the content inside the text field.
fillColorColor?Background color of the text field.
borderBoxBorder?Custom border for the text field. Overrides the default border.
borderRadiusBorderRadiusGeometryCorner radius for the text field borders.
heightdouble?Height of the text field container.
minLinesint?Minimum number of lines to show (for multiline text fields).
maxLinesint?Maximum number of lines to show (for multiline text fields).
initialValueString?Default text to display when the text field is first created.
onChangedvoid Function(String)?Callback function when the text value changes.
suffixPaddingEdgeInsetsGeometry?Custom padding for the suffix icon.
prefixPaddingEdgeInsetsGeometry?Custom padding for the prefix icon.
focusNodeFocusNode?Focus node that controls the focus state of this text field.