Text Input
Commonly used text input component.
Installation
npx wdc add inputExamples
Basic
Standard input fields with labels.
With Icons
Add icons or text as prefix/suffix. Padding adjusts automatically.
USD
Validation
Visual feedback for error and success states.
Password
Built-in visibility toggle for password fields.
Login Form
Login form with input fields
API Reference
| Input | Type | Default | Description |
|---|---|---|---|
| label | string | '' | Text label displayed above the input. |
| type | 'text' | 'email' | 'password' | 'number' | 'text' | HTML input type. |
| placeholder | string | '' | Placeholder text. |
| error | string | null | null | Error message text. Changes border color to red. |
| success | boolean | false | If true, changes border color to green. |
| hint | string | null | null | Helper text displayed below the input. |
| size | 'sm' | 'default' | 'lg' | 'default' | Controls the height and font size. |
check_circle
SEO & Accessibility
Using [id] on the input and [for] on the label ensures screen readers associate the label correctly. The aria-invalid and aria-describedby attributes help accessibility tools announce errors automatically.