--- title: Input description: Text input component for forms and user input sidebar: auto --- # Input ## Overview The Input component provides a styled text input field that extends the native HTML input element with consistent styling and error state support. ## Live Demo :::demo input-variants Shows all input states including default, error, and disabled ::: ## Props ## States ### Default Standard input field with border and focus ring. ### Error Error state with destructive border color. Set the `error` prop to `true`. ### Disabled Disabled state with reduced opacity. Set the `disabled` prop to `true`. ### Focus Focused state with ring outline. ## Usage Examples ### Basic Input ```tsx import { Input } from '@/components/ui/Input' function Example() { return } ``` ### Controlled Input ```tsx import { Input } from '@/components/ui/Input' function Example() { const [value, setValue] = useState('') return ( setValue(e.target.value)} placeholder="Enter text..." /> ) } ``` ### Input with Error State ```tsx import { Input } from '@/components/ui/Input' function Example() { return ( ) } ``` ### Password Input ```tsx import { Input } from '@/components/ui/Input' function Example() { return } ``` ## Accessibility - **Keyboard Navigation**: Full native keyboard support - **ARIA Attributes**: Supports all standard input ARIA attributes - **Focus Visible**: Clear focus indicator for keyboard navigation - **Error State**: Visual indication for error state (use with `aria-invalid` and `aria-describedby`) ## Related Components - [Button](/components/ui/button) - [Select](/components/ui/select) - [Checkbox](/components/ui/checkbox)