Input
Text input component with support for icons, validation states, and various input types.
Import
tsx
import { ZInput } from "@zurto/ui";Basic Usage
With Label
Required Field
Input Types
Sizes
With Icons
Validation States
Error State
Please enter a valid email address
Success State
With Helper Text
Must be at least 8 characters
Disabled State
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url' | 'text' | HTML input type |
size | 'sm' | 'md' | 'lg' | 'md' | Input size |
label | string | – | Label text above the input |
placeholder | string | – | Placeholder text |
value | string | – | Controlled input value |
defaultValue | string | – | Default value for uncontrolled input |
onChange | (e: ChangeEvent) => void | – | Change event handler |
leftIcon | ReactNode | – | Icon displayed on the left |
rightIcon | ReactNode | – | Icon displayed on the right |
error | string | boolean | – | Error state or error message |
success | boolean | false | Success validation state |
hint | string | – | Helper text below input |
disabled | boolean | false | Disable the input |
required | boolean | false | Mark as required |
clearable | boolean | false | Show clear button when input has value |
Accessibility
- Uses native
<input>element with propertypeattribute aria-invalid="true"applied on error statearia-describedbylinks input to error/hint messagearia-requiredapplied when required- Clear button is keyboard accessible with proper
aria-label
Keyboard Support
| Key | Action |
|---|---|
Tab | Move focus to/from input |
Escape | Clear input (when clearable) |
Enter | Submit form (in form context) |