Input
Single-line text field with validation state, focus ring and file/placeholder support.
Install
Install the component
Add the source straight into your project with the shadcn CLI — no package dependency to track.
npx shadcn@latest add https://vert-ui.dev/r/input.jsonPreview
Live preview
Found in workspace settings.
Usage
Examples
Invalid state
Enter a valid email address.
<Input invalid aria-label="Email" placeholder="you@example.com" />
<p className="text-xs font-medium text-destructive">
Enter a valid email address.
</p>With label and hint
Visible to everyone in the org.
<div className="space-y-2">
<Label htmlFor="workspace">Workspace name</Label>
<Input id="workspace" placeholder="Acme Inc" />
<p className="text-xs text-muted-foreground">Visible to everyone in the org.</p>
</div>Sizes and disabled
<Input size="sm" placeholder="Small" aria-label="Small" />
<Input size="md" placeholder="Medium" aria-label="Medium" />
<Input size="lg" placeholder="Large" aria-label="Large" />
<Input disabled defaultValue="Locked field" aria-label="Disabled" />Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "sm" | "md" | "lg" | "md" | Control height and text scale. Use lg on touch-first or prominent fields. |
| invalid | boolean | — | Marks the field invalid: sets aria-invalid, data-invalid and the destructive border. |
| type | string | "text" | Native input type — email, password, search, number… |
| placeholder | string | — | Hint shown while empty. Not a substitute for a label. |
| disabled | boolean | — | Native disabled state — dimmed, skipped by tab and pointer. |
| required | boolean | — | Native required flag: browser validation plus SR announcement. |
| …native input attrs | InputHTMLAttributes<HTMLInputElement> | — | value, onChange, autoComplete, minLength, inputMode, … |
Accessibility
Accessibility notes
- Every input needs a programmatic name: pair it with Label htmlFor (or use Field, which wires it for you).
- invalid flips aria-invalid — screen readers announce the state on focus; keep an inline error text linked by aria-describedby (Field does this automatically).
- Placeholders vanish on typing and often fail contrast — keep them for examples, labels for real forms.
- Native required works with browser validation; a visual asterisk alone is not enough.