Input
A text input with label, helper text, error state, and icon slot support
Quick Preview
We'll never share your email.
Structure
Anatomy of the Input component β every optional layer is labeled.
States
Click inside any cell to focus the input and observe the live focus ring.
Input β all states
Click inside each cell to trigger the live focus state
Default
Empty β resting
Filled
Value entered
Focus
β Click to focus
Invalid email address
Error
errorText is set
Must include a number
With helper
helperText guidance
Disabled
Cannot interact
Sizes
Three size tokens β sm md (default) lg.
Sizes β sm / md / lg
Click each input to compare focus ring sizes
Small β sm
px-3 py-1.5 text-sm
Medium β md
px-4 py-2.5 text-sm Β· default
Large β lg
px-4 py-3 text-base
Installation
// Copy the Input component fromsrc/components/ui/Input.tsx
Usage
import { Input } from '@/components/ui/Input'export default function Example() {return (<Inputlabel="Username"placeholder="Enter username"helperText="Min 3 characters"/>)}
Examples
With Icons
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
Extends all native <input> attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | - | Label text above the input |
helperText | string | - | Helper text below the input |
errorText | string | - | Error message β replaces helperText and applies error styling |
size | "sm" | "md" | "lg" | "md" | Size of the input |
leftIcon | React.ReactNode | - | Icon on the left inside the input |
rightIcon | React.ReactNode | - | Icon on the right inside the input |
disabled | boolean | - | Disable input interactions |
Features
- βForwardRef support
- βAccessible label/input association via id
- βError state with aria-invalid + aria-describedby
- βLeft and right icon slots
- βThree sizes (sm, md, lg)
- βPrimary color focus ring