Overview
The Input component provides a flexible text input field with support for various types, validation states, icons, and helper text.Basic Usage
Input Types
The Input component supports all standard HTML input types:- Text
- Email
- Password
- Number
- Search
Sizes
The default size is
md if not specified.Validation States
Error State
Success State
With Helper Text
Labels and Descriptions
Icons
Add icons to enhance the input’s visual context:Props
string
default:"text"
HTML input type:
text, email, password, number, search, tel, url, etc.string
default:"md"
Input size:
sm, md, or lgstring
Label text displayed above the input
string
Placeholder text shown when input is empty
string
Controlled input value
string
Default value for uncontrolled input
function
Change event handler:
(event: React.ChangeEvent<HTMLInputElement>) => voidboolean
default:"false"
Whether the input is in an error state
string
Error message to display below the input
boolean
default:"false"
Whether the input is in a success state
string
Success message to display below the input
string
Helper text displayed below the input
boolean
default:"false"
Whether the input is disabled
boolean
default:"false"
Whether the input is required
boolean
default:"false"
Makes the input expand to fill its container width
ReactNode
Icon to display on the left side of the input
ReactNode
Icon to display on the right side of the input
string
Additional CSS class names to apply
TypeScript Interface
Advanced Examples
Controlled Input with Validation
Password Input with Toggle
Accessibility
- Properly associates labels with inputs using
htmlFor - Supports ARIA attributes for error and helper text
- Keyboard navigable with standard tab order
- Screen reader compatible with descriptive labels