--- id: input sidebar_label: 'Input' sidebar_position: 1 --- # Input A flexible text input component built on React Aria's `Input` component with consistent styling and accessibility features. ## Props | Prop | Type | Default | Description | | -------------- | ---------------------------------------------------- | -------- | --------------------------------------------- | | `label` | `string` | - | Optional label text displayed above the input | | `placeholder` | `string` | - | Placeholder text shown when input is empty | | `value` | `string` | - | Controlled value | | `defaultValue` | `string` | - | Initial value for uncontrolled mode | | `onChange` | `(value: string) => void` | - | Called when input value changes | | `isDisabled` | `boolean` | `false` | Whether the input is disabled | | `isReadOnly` | `boolean` | `false` | Whether the input is read-only | | `isRequired` | `boolean` | `false` | Whether the input is required | | `type` | `text \| search \| url \| tel \| email \| password` | `'text'` | HTML input type (text, email, password, etc.) | Extends all [React Aria TextFieldProps](https://react-spectrum.adobe.com/react-aria/TextField.html#props). ## Usage Examples ### Default Input ```tsx live ``` ### With Label ```tsx live ``` ### With Default Value ```tsx live ``` ### Disabled State ```tsx live ``` ### Read-Only State ```tsx live ``` ### Password Input ```tsx live ``` ### Search Input ```tsx live function SearchInputDemo() { const [searchQuery, setSearchQuery] = useState(''); return ; } ``` ## Styling ### CSS Variables The component uses the following CSS variables for theming: - `--color-bg`: Input background color - `--hl-sm`: Standard border color - `--hl-lg`: Highlight for focus/active - `--color-danger`: Error/invalid state color You can customize these variables in your CSS to theme the input appearance.