Overview
HuxInput is a customizable text input component with consistent styling and extensive customization options. It provides a clean, modern text input with support for labels, hints, validation, icons, and different sizes while automatically adapting to light and dark themes.Basic Usage
Simple Text Input

Input with Icon

Input with Helper Text

Input with Error State

Properties
Core Properties
label
- Optional field label text displayed above the inputhint
- Placeholder text displayed inside the input when emptycontroller
- TextEditingController for managing input stateonChanged
- Callback triggered when the input value changesonSubmitted
- Callback triggered when the user submits the input
Validation Properties
validator
- Form validation function that returns error text or nullerrorText
- Custom error message (overrides validator output)helperText
- Helper text displayed below the input
Icon Properties
prefixIcon
- Icon displayed at the beginning of the inputsuffixIcon
- Icon displayed at the end of the inputiconSize
- Custom size for icons (default: 18px)
Behavior Properties
obscureText
- Whether to hide the input text (for passwords)enabled
- Whether the input is interactivemaxLines
- Maximum number of text lines (default: 1)keyboardType
- Type of keyboard to displaytextInputAction
- Action button for the keyboard
Layout Properties
width
- Custom width (default: full width)
Styling & Dimensions
Fixed Dimensions
- Height: 40px (consistent across all inputs)
- Border Radius: 8px (rounded corners)
- Font Size: 14px with 1.4 line height
Padding & Spacing
- Horizontal Padding: 18px (left and right inside input)
- Vertical Padding: 12px (top and bottom inside input)
- Label Gap: 6px (space between label and input)
Icon Spacing
- Icon Size: 18px (default, customizable)
- Icon Outer Padding: 14px (space from edge to icon)
- Icon Inner Padding: 4px (space between icon and text)
Color System
Border Colors
- Default:
HuxTokens.borderPrimary(context)
- Focused:
HuxTokens.primary(context)
with 50% opacity - Error:
HuxTokens.borderDestructive(context)
- Focused Error:
HuxTokens.textDestructive(context)
with 2px width - Disabled:
HuxTokens.borderSecondary(context)
Background Colors
- Enabled:
HuxTokens.surfacePrimary(context)
- Disabled:
HuxTokens.surfaceSecondary(context)
Text Colors
- Input Text: Inherits from theme with 14px font size
- Label Text:
HuxTokens.textSecondary(context)
with medium weight - Icon Color:
HuxTokens.iconSecondary(context)
States
Enabled State

- Fully interactive with normal styling
- Responds to user input and focus
Focused State

- Enhanced border with primary color
- Visual focus indicator for accessibility
Disabled State

- Reduced opacity and non-interactive
- Maintains visual consistency
Examples
Form Building
See HuxInput in action within forms
Validation Patterns
Learn form validation best practices
Related Components
- HuxDateInput - Specialized date input component
- HuxCheckbox - Interactive checkbox component
- HuxSwitch - Toggle switch component