Input
Displays a form input field or a component that looks like an input field.
Installation
pnpm dlx cubix@latest add input --base radixUsage
import { Input } from "@/components/cubix/input"<Input type="email" placeholder="Email" />Examples
Types
Every native input type is supported - file inputs even get styled file-button treatment:
With icon
Compose the Input with plain elements - icons are just siblings positioned with Tailwind:
Invalid state
Set aria-invalid to switch to destructive border and ring styles - no extra prop needed:
Disabled
In a form
Pair the Input with the Button to build native, accessible forms:
API Reference
Note: The input renders data-slot="input" for targeting in tests and parent selectors, and switches to destructive styles automatically when aria-invalid is set.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| type | string (e.g. "text" | "email" | "password" | "file" | "search") | "text" | The native input type. File inputs get styled file-button treatment. |
| aria-invalid | boolean | - | Marks the field as invalid and applies destructive border/ring styles automatically. |
| disabled | boolean | false | Disables the input and prevents interaction. |
| placeholder | string | - | Hint text shown when the input is empty (styled with muted-foreground). |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| ...props | React.ComponentProps<'input'> | - | All native input attributes (value, onChange, required, min, max, ...) are forwarded to the rendered element. |