Components
Input
A flexible input component with built-in styling and accessibility features.
Installation
bunx --bun harukit@latest add input
npx harukit@latest add input
pnpm dlx harukit@latest add input
yarn harukit@latest add input
Example
import { Input } from "@/components/ui/input";
export function InputDemo() {
return (
<div className="grid w-full items-center gap-1.5">
<label htmlFor="email">Email</label>
<Input type="email" id="email" placeholder="Enter your email" />
</div>
);
}
Usage
Import
import { Input } from "@/components/ui/input";
Code
<Input />
API Reference
Prop | Type | Default | Description |
---|---|---|---|
type | string | "text" | The type of input. |
placeholder | string | - | Placeholder text for the input. |
disabled | boolean | false | When true , prevents the user from interacting with the input. |
readOnly | boolean | false | When true , the input is read-only. |
required | boolean | false | When true , the input is required. |
value | string | - | The value of the input. |
onChange | (event: ChangeEvent<HTMLInputElement>) => void | - | Event handler called when the value changes. |
onFocus | (event: FocusEvent<HTMLInputElement>) => void | - | Event handler called when the input receives focus. |
onBlur | (event: FocusEvent<HTMLInputElement>) => void | - | Event handler called when the input loses focus. |