abaabil

Textarea

7th lightest of the thirteen, by js weight

A native <textarea> with the same label, description and error wiring as Input. The one form control the library was missing.

Example (a11y tier)

A sentence or two. Shown on your public profile.

Import

import Textarea from 'abaabil/textarea'         // structure only
import Textarea from 'abaabil/textarea/styled'  // + CSS
import Textarea from 'abaabil/textarea/a11y'    // + label/description/error

Two defaults that differ from the browser's

rows defaults to 3 rather than the browser's 2. Two rows is too short to read back what you just typed in almost any real form, so the browser default is one every project overrides. Overriding it once here is cheaper than overriding it everywhere.

resize is set to block, not both. A textarea the user can drag wider than the column it sits in breaks the form's layout, and nobody drags one wider on purpose. Vertical resizing, which people do want, still works.

Props

PropTypeDefaultTierDescription
rowsnumber3allVisible line count.
classNamestringallMerged with the base class.
labelstringa11yRendered as a real <label>, associated via htmlFor/id.
hideLabelbooleanfalsea11yHide the label visually. It stays in the accessibility tree.
descriptionstringa11yHelp text, wired into aria-describedby.
errorstringa11ySets aria-invalid and joins aria-describedby.
requiredbooleanfalsea11y
idstringa11yOverrides the generated id.
...propsallEverything else (name, maxLength, onChange, ...) lands on the <textarea>.