Input
Um campo de texto para respostas curtas. Tem 44px de altura no padrão e 48px no tamanho Large, sempre com texto de 16px.
Instalação
npx shadcn@latest add @sevenone/inputUso
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"Exemplos
Com rótulo e dica
O rótulo fica 8px acima do campo e a dica 6px abaixo.
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>Erro
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>Desativado
<Input disabled placeholder="Not editable" />Acessibilidade
- Sempre junte o campo a um Label (htmlFor = id).
- Ligue dicas e erros com aria-describedby.
- Erros usam aria-invalid; a mensagem é texto, nunca só cor.
- O placeholder e o texto digitado têm 7:1.