Input
Input fields allow users to enter text, email, passwords, numbers, dates and files.
Installation
Add the Input component using the Binhlaig UI CLI.
npx binhlaig-ui@latest add inputImport
Import the Input component from your UI directory.
import { Input } from "@/components/ui/input";Usage
Use Input for simple text entry.
Input Types
Input supports all standard HTML input types.
With Label
Use a label to clearly identify the requested value.
With Description
Supporting text can explain the expected input value.
This will be your public display name.
With Icons
Add an icon to provide visual context.
Password Input
Allow users to show or hide their password.
Disabled State
Disabled inputs cannot be edited or focused.
Error State
Use aria-invalid and error styles for invalid values.
Enter a valid email address.
File Input
Use the file input type to upload files.
Form Example
Combine inputs and buttons to create a complete form.
API Reference
The Input component accepts standard React input properties.
| Prop | Type | Default | Description |
|---|---|---|---|
type | React.HTMLInputTypeAttribute | "text" | Controls the type of input value. |
placeholder | string | — | Displays temporary hint text. |
value | string | number | — | Controls the current input value. |
defaultValue | string | number | — | Sets the initial uncontrolled value. |
disabled | boolean | false | Prevents interaction with the input. |
readOnly | boolean | false | Prevents editing while allowing focus. |
required | boolean | false | Marks the input as required. |
aria-invalid | boolean | false | Marks the current value as invalid. |
className | string | — | Adds custom Tailwind CSS classes. |
onChange | React.ChangeEventHandler<HTMLInputElement> | — | Runs whenever the input value changes. |