> ## Documentation Index
> Fetch the complete documentation index at: https://neo.tvk.company/llms.txt
> Use this file to discover all available pages before exploring further.

# Text Field

> A versatile input field for capturing user text input with support for icons, labels, validation, and various input types.

## Examples

<Tabs>
  <Tab title="Basic Usage">
    <Frame caption="Basic text field with different states and features.">
      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_basic_light.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=a8bc801227abf61abe5751faed7aa7fa" alt="Basic text field example" noZoom className="block dark:hidden" width="1536" height="768" data-path="images/widgets/inputs/text-field/text_field_basic_light.png" />

      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_basic_dark.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=6b9ed6a47b2e25c10cd29dab1e71433c" alt="Basic text field example" noZoom className="hidden dark:block" width="1536" height="768" data-path="images/widgets/inputs/text-field/text_field_basic_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart Simple Text Field lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        onChanged: (value) {
          // Handle input
        },
      ),
      ```

      ```dart With Label lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Full Name",
        placeholder: "Enter your full name",
        onChanged: (value) {
          // Handle input
        },
      ),
      ```

      ```dart With Description lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Username",
        placeholder: "Choose a username",
        description: "Must be at least 3 characters long",
        onChanged: (value) {
          // Handle input
        },
      ),
      ```
    </CodeGroup>
  </Tab>

  <Tab title="With Icons & Affixes">
    <Frame caption="Text fields with icons, prefixes, and suffixes.">
      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_icons_light.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=871c396a12da2140e5bae8cb1e79e0af" alt="Text field with icons example" noZoom className="block dark:hidden" width="1536" height="768" data-path="images/widgets/inputs/text-field/text_field_icons_light.png" />

      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_icons_dark.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=26737211b4a3247c7177296753a09c32" alt="Text field with icons example" noZoom className="hidden dark:block" width="1536" height="768" data-path="images/widgets/inputs/text-field/text_field_icons_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart With Icon lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        icon: PhosphorIconsRegular.magnifyingGlass,
        placeholder: "Search products...",
        onChanged: (value) {
          // Handle input
        },
      ),
      ```

      ```dart With Prefix lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Price",
        prefix: "€",
        placeholder: "0.00",
        keyboardType: .numberWithOptions(decimal: true),
        onChanged: (value) {
          // Handle input
        },
      ),
      ```

      ```dart With Suffix lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Weight",
        suffix: "kg",
        placeholder: "0.00",
        keyboardType: .numberWithOptions(decimal: true),
        onChanged: (value) {
          // Handle input
        },
      ),
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Input Types">
    <Frame caption="Different input types and specialized configurations.">
      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_types_light.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=b195296161357fdddd8bbd7a59f10604" alt="Text field types example" noZoom className="block dark:hidden" width="1536" height="512" data-path="images/widgets/inputs/text-field/text_field_types_light.png" />

      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_types_dark.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=9a911b596620def65addd4ca010484ba" alt="Text field types example" noZoom className="hidden dark:block" width="1536" height="512" data-path="images/widgets/inputs/text-field/text_field_types_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart Email Input lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Email Address",
        icon: PhosphorIconsRegular.envelope,
        keyboardType: .emailAddress,
        autofillHints: [AutofillHints.email],
        placeholder: "you@example.com",
        onChanged: (value) {
          // Handle input
        },
      ),
      ```

      ```dart Password Input lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Password",
        icon: PhosphorIconsRegular.lock,
        obscureText: true,
        autofillHints: [AutofillHints.password],
        placeholder: "Enter your password",
        onChanged: (value) {
          // Handle input
        },
      ),
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Error States">
    <Frame caption="Text field validation and error handling.">
      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_errors_light.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=17d6c9496584ae92ce717eca5433f2d2" alt="Text field error states example" noZoom className="block dark:hidden" width="1536" height="384" data-path="images/widgets/inputs/text-field/text_field_errors_light.png" />

      <img src="https://mintcdn.com/tvk/xOcwrKRVA4J0vbxn/images/widgets/inputs/text-field/text_field_errors_dark.png?fit=max&auto=format&n=xOcwrKRVA4J0vbxn&q=85&s=0a53c7a50c5d1dfe2b770bf59df51ba2" alt="Text field error states example" noZoom className="hidden dark:block" width="1536" height="384" data-path="images/widgets/inputs/text-field/text_field_errors_dark.png" />
    </Frame>

    <CodeGroup>
      ```dart With Error lines theme={null}
      NeoTextField(
        controller: controller, // Using e.g. useTextEditingController() hook
        label: "Email Address",
        icon: PhosphorIconsRegular.envelope,
        keyboardType: .emailAddress,
        placeholder: "you@example.com",
        errorText: "Please enter a valid email address",
        onChanged: (value) {
          // Handle input
        },
      ),
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Properties

### Required

<ParamField path="controller" type="TextEditingController" required>
  The controller for the text field that manages the text being edited.
</ParamField>

### Content

<ParamField path="label" type="String">
  The label text displayed above the text field.
</ParamField>

<ParamField path="placeholder" type="String" default="Type here...">
  The placeholder text shown when the field is empty.
</ParamField>

<ParamField path="description" type="String">
  Additional descriptive text displayed below the field. Useful for providing context or input requirements.
</ParamField>

<ParamField path="prefix" type="String">
  Text displayed at the beginning of the input area (e.g., "€", "https\://").
</ParamField>

<ParamField path="suffix" type="String">
  Text displayed at the end of the input area (e.g., ".com", "kg").
</ParamField>

<ParamField path="icon" type="PhosphorIconData">
  An optional icon displayed at the beginning of the field. Use `PhosphorIconsRegular.iconName`.
</ParamField>

### Layout

<ParamField path="hasBorder" type="bool" default="true">
  Whether the text field should display a border. When false, creates a borderless input suitable for inline editing.
</ParamField>

<ParamField path="hasPadding" type="bool" default="true">
  Whether the text field should have internal padding. When false, removes padding for custom layouts.
</ParamField>

<ParamField path="showClearButton" type="bool" default="false">
  Whether to show a clear button (x) that allows users to quickly clear the text field content.
</ParamField>

### Input Configuration

<ParamField path="keyboardType" type="TextInputType">
  The type of keyboard to display for text input (e.g., `.emailAddress`, `.phone`).
</ParamField>

<ParamField path="inputFormatters" type="List<TextInputFormatter>">
  Optional input formatters to restrict or modify input (e.g., length limits, character filters).
</ParamField>

<ParamField path="autofillHints" type="List<String>">
  Hints for autofill services to provide appropriate suggestions (e.g., `[AutofillHints.email]`).
</ParamField>

<ParamField path="obscureText" type="bool" default="false">
  Whether to hide the text being entered. Typically used for password fields.
</ParamField>

### State

<ParamField path="errorText" type="String">
  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`.
</ParamField>

<ParamField path="focusNode" type="FocusNode">
  Focus node for managing focus state programmatically. When not provided, the widget creates its own internal focus node.
</ParamField>

<ParamField path="isEnabled" type="bool" default="true">
  Controls whether the text field is interactive. When `false`, the field dims, ignores input and focus, and shows a forbidden cursor.
</ParamField>

### Callbacks

<ParamField path="onChanged" type="ValueChanged<String>">
  Callback function called whenever the text changes. Receives the current text value.
</ParamField>

<ParamField path="onSubmitted" type="ValueChanged<String>">
  Callback function called when the user submits the text (e.g., pressing Enter). Receives the current text value.
</ParamField>

<ParamField path="onBlur" type="VoidCallback">
  Callback function called when the field loses focus. Useful for explicit blur event handling.
</ParamField>

<ParamField path="maintainFocusOnSubmit" type="bool" default="false">
  Whether to keep focus on the field after submission. Useful for forms where users might submit multiple times (e.g. a chat input).
</ParamField>

## 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` and `autofillHints` 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.
