Input
A text field for short answers. 44px tall by default and 48px with the Large size, always with 16px text.
Installation
npx shadcn@latest add @sevenone/inputUsage
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"Examples
With label and hint
The label sits 8px above the field and the hint 6px below it.
We will only use it to send your receipt.
<div className="grid w-full max-w-sm gap-2">
<Label htmlFor="email" required>Email</Label>
<div className="grid gap-1.5">
<Input id="email" type="email" placeholder="you@company.com" aria-describedby="email-hint" />
<p id="email-hint" className="text-sm text-muted-foreground">
We will only use it to send your receipt.
</p>
</div>
</div>Error
Enter at least 2 characters.
<Input id="name" aria-invalid aria-describedby="name-error" />
<p id="name-error" className="text-sm text-destructive-text">
Enter at least 2 characters.
</p>Disabled
<Input disabled placeholder="Not editable" />Accessibility
- Always pair the input with a Label (htmlFor = id).
- Connect hints and errors with aria-describedby.
- Errors use aria-invalid; the message is text, never color alone.
- Placeholder and value text are 7:1.