Input
contactfrom shadcn/ui Essentials
Input
AI Usage Rules
Use Input for single-line text entry. Always pair with a label element. Use aria-invalid for error states.
Code Template
import * as React from "react"
import { cn } from "@/lib/utils"
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
<input
type={type}
data-slot="input"
className={cn(
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm",
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
className
)}
{...props}
/>
)
}
export { Input }Props Schema
| Property | Type | Default | Description |
|---|---|---|---|
| type | string | — | |
| placeholder | string | — |
View raw JSON schema
{
"type": "object",
"properties": {
"type": {
"enum": [
"text",
"email",
"password",
"number",
"search",
"tel",
"url"
],
"type": "string"
},
"placeholder": {
"type": "string"
}
}
}