Input, Textarea
FrondLabel; errors via aria-invalid and a Note.Usage
The import, then a use to start from. Both copy as they are.
Import
import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";import { TextArea } from "@/components/ui/textarea";Example
<div className="flex flex-col gap-2"> <Label htmlFor="domain">Custom domain</Label> <Input id="domain" placeholder="docs.acme.dev" aria-invalid={error != null} aria-describedby="domain-help" /> <p id="domain-help" className={error ? "text-danger text-xs" : "text-muted text-xs"}> {error ?? "Point a CNAME record at Fern before you add it."} </p></div>When to use
Use it for
- Every field has a visible
Labelabove it, tied byhtmlForandid. A placeholder shows an example, never the label. size="sm"in toolbars and dense rows; the default everywhere else.TextAreafor anything that runs past one line: a description, a prompt, a note.- A field's error sets
aria-invalidand replaces its help text. An error about the whole form goes in aNoteabove its actions.
Avoid
- A raw
<input>or<textarea>: they miss the border, the focus ring and the invalid state. - Picking from a known list: use
SelectorSearchableDropdown. - On and off settings: use
SwitchorCheckbox.
Accessibility
Checks
aria-describedbypoints at the help or error text, so it's read with the field.- Forms submit on Enter, and Tab moves through the fields in reading order.
API
Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.
Input
| Prop | Values |
|---|---|
| type | "text""password""email""number""search""url" |
| size | "default""sm" |
| disabled | boolean |
VariantsDefaultSmallWithValuePasswordNumberDisabledInvalid
TextArea
| Prop | Values |
|---|---|
| disabled | boolean |
VariantsDefaultWithValueDisabledInvalid