Textarea
Retrieve multi-line user input.
Best Practices
- Pick
<Textarea>for content that wraps to multiple lines (commit messages, descriptions, notes); use Input for a single value like a name or domain. - Set a generous default
rowsand grow only when the surface has vertical room; don’t let the field push primary actions below the fold. - Validate on blur and pass a string to
errorto render the inline message; the validation replaces helper text on failure. - Trim leading and trailing whitespace on submit so empty newlines don’t pass a
requiredcheck. - Labels are short Title Case nouns (
Description,Release Notes); placeholders show an example value, not instructions likeEnter a description. - Validation names the field and constraint, ends in a period, and skips
please(Description is required.,Release notes can’t exceed 500 characters.). - Render helper text as a sibling
<p>linked througharia-describedby; sentence case, one sentence, with a period.
Was this helpful?