Input
A single-line text field with optional label and helper text. Supports default, error, and success states with matching focus rings and helper text colors — all driven by AvilaDS tokens.
Preview
Default
Must be 3–20 characters.
States
Invalid email address.
Looks good!
Sizes
Usage
import { Input } from '@/components/Input';
// Default with label
<Input label="Email" placeholder="you@example.com" />
// With helper text
<Input
label="Username"
placeholder="your-username"
helperText="Must be 3–20 characters."
/>
// Error state
<Input
variant="error"
label="Email"
placeholder="you@example.com"
helperText="Invalid email address."
/>
// Success state
<Input
variant="success"
label="Email"
placeholder="you@example.com"
helperText="Looks good!"
/>
// Sizes
<Input inputSize="sm" placeholder="Small" />
<Input inputSize="md" placeholder="Medium" />
<Input inputSize="lg" placeholder="Large" />
// Full width
<Input label="Full width" placeholder="Stretches to container" fullWidth />
// Disabled
<Input label="Read only" placeholder="Not editable" disabled />Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'error' | 'success' | 'default' | Visual state of the input. error shows a hot-pink border; success shows a teal border. Both affect the focus ring and helper text color. |
inputSize | 'sm' | 'md' | 'lg' | 'md' | Height and padding. sm = 36px, md = 44px, lg = 52px. Named inputSize to avoid collision with the native HTML size attribute. |
label | string | — | Label text rendered above the input. Automatically associated via htmlFor/id. |
helperText | string | — | Helper or validation message rendered below the input. Color follows variant. |
fullWidth | boolean | false | Stretches the input to fill its container width. |
disabled | boolean | false | Disables the input, reduces opacity to 0.4, and sets aria-disabled. |
placeholder | string | — | Placeholder text shown when the input is empty. |
id | string | — | HTML id. Auto-generated from label if omitted. |
className | string | — | Additional CSS class names merged into the input element. |