Input

Displays a form input field or a component that looks like an input field.

Installation

pnpm dlx cubix@latest add input

Usage

Import
import { Input } from "@/components/cubix/input"
Example
<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

PropTypeDefaultDescription
typestring (e.g. "text" | "email" | "password" | "file" | "search")"text"The native input type. File inputs get styled file-button treatment.
aria-invalidboolean-Marks the field as invalid and applies destructive border/ring styles automatically.
disabledbooleanfalseDisables the input and prevents interaction.
placeholderstring-Hint text shown when the input is empty (styled with muted-foreground).
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
...propsReact.ComponentProps<'input'>-All native input attributes (value, onChange, required, min, max, ...) are forwarded to the rendered element.