# Input Text input component with consistent styling. Supports all standard HTML input types with proper focus states and accessibility features. ## Installation ```bash deno run -A jsr:@lockness/ui add input ``` ## Usage ```tsx import { Input } from '@lockness/ui/components' ``` ## Props | Prop | Type | Default | Description | | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------- | | type | `'text' \| 'email' \| 'password' \| 'number' \| 'tel' \| 'url' \| 'search' \| 'date' \| 'time' \| 'datetime-local' \| 'month' \| 'week' \| 'file' \| 'hidden'` | `'text'` | Input type | | name | `string` | - | Input name attribute | | value | `string \| number` | - | Input value | | placeholder | `string` | - | Placeholder text | | disabled | `boolean` | `false` | Disable input | | readonly | `boolean` | `false` | Read-only input | | required | `boolean` | `false` | Required field | | autocomplete | `string` | - | Autocomplete attribute | | class | `string` | - | Additional CSS class names | | id | `string` | - | Element id attribute | ## Input Types ### Text (default) ```tsx ``` ### Email ```tsx ``` ### Password ```tsx ``` ### Number ```tsx ``` ### Search ```tsx ``` ### Date & Time ```tsx ``` ### File ```tsx ``` ### Telephone & URL ```tsx ``` ## States ### Disabled ```tsx ``` ### Read-only ```tsx ``` ### Required ```tsx ``` ## Examples ### With Label ```tsx
``` ### Form Group ```tsx
``` ### With Custom Width ```tsx ``` ### With Error State ```tsx

Please enter a valid email address.

``` ### Input with Button ```tsx
``` ### Search Input ```tsx
``` ## Accessibility - Uses semantic `` element - Proper focus ring styling with `focus-visible` - Supports all standard input attributes (`aria-*`, `required`, etc.) - Placeholder text uses muted color for contrast - Disabled state has reduced opacity and blocked interactions ## CSS Variables ```css @theme { --radius: 0.5rem; --input: 220 13% 91%; --background: 0 0% 100%; --muted-foreground: 220 9% 46%; --ring: 221 83% 53%; --ring-offset: 0 0% 100%; } ``` ## Styling The Input component includes: - 40px height (`h-10`) - Full width by default (`w-full`) - Rounded corners using `--radius` - Border with `--input` color - Focus ring with offset - Disabled styling with opacity and cursor - File input styling for clean file inputs ## Theming The Input component can be fully customized using CSS variables. This allows you to adjust dimensions, colors, spacing, and borders to match your design system while maintaining consistent behavior across your application. ### Available CSS Variables | Variable | Default | Description | | ----------------------- | ------------------- | ----------------------------------- | | `--input-height` | `2.5rem` | Height of the input field | | `--input-padding-x` | `0.75rem` | Horizontal padding inside the input | | `--input-padding-y` | `0.5rem` | Vertical padding inside the input | | `--input-font-size` | `0.875rem` | Font size of the input text | | `--input-border-radius` | `var(--radius)` | Border radius of the input corners | | `--input-border-color` | `var(--input)` | Border color of the input | | `--input-background` | `var(--background)` | Background color of the input | ### Theming Examples #### Global Customization Add these styles to your `app.css` to customize all Input components across your application: ```css :root { /* Larger inputs with more padding */ --input-height: 3rem; --input-padding-x: 1rem; --input-padding-y: 0.75rem; --input-font-size: 1rem; /* Custom border styling */ --input-border-radius: 0.375rem; --input-border-color: hsl(210 40% 80%); /* Dark mode theme */ --input-background: hsl(222 47% 11%); } ``` #### Local Overrides Override theming for specific inputs using inline styles: ```tsx {/* Compact input */} {/* Large input with custom colors */} {/* Minimal rounded input */} ```