Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Forms

Textarea

Free11.7 KB gzipped

Multi-line text field. Works standalone or inside a Field, which wires the id, label, hint, error, required, disabled, and size automatically.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab · Full report

Import

tsx
import { Textarea } from "@vjdesigns/vjdesigns-ui";

Importing only Textarea adds about 11.7 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Auto resize

autoResize grows the field with its content, between minRows and maxRows.

tsx
import { Field, Textarea } from "@vjdesigns/vjdesigns-ui";

export function AutoResize() {
  return (
    <div style={{ width: "100%", maxWidth: "26rem" }}>
      <Field label="Message">
        <Textarea autoResize minRows={2} maxRows={8} placeholder="Write a message…" />
      </Field>
    </div>
  );
}

Character count

showCount with maxLength shows a live character counter.

52 of 160 characters used
tsx
import { Field, Textarea } from "@vjdesigns/vjdesigns-ui";

export function CharacterCount() {
  return (
    <div style={{ width: "100%", maxWidth: "26rem" }}>
      <Field label="Short bio">
        <Textarea showCount maxLength={160} rows={3} defaultValue="Designer and developer building accessible products." />
      </Field>
    </div>
  );
}

Variants

tsx
import { Stack, Textarea } from "@vjdesigns/vjdesigns-ui";

export function Variants() {
  return (
    <Stack gap={3} style={{ width: "100%", maxWidth: "26rem" }}>
      <Textarea aria-label="Outline" rows={2} placeholder="Outline (default)" />
      <Textarea aria-label="Filled" rows={2} variant="filled" placeholder="Filled" />
      <Textarea aria-label="Invalid" rows={2} invalid defaultValue="Something's wrong here" />
    </Stack>
  );
}

Accessibility

showCount (with maxLength) links an "n / max" counter to the textarea with aria-describedby. Remaining characters are announced politely only once 90% of the limit is used, so typing isn't drowned out by announcements.

58 of 120 characters used

Gate codes, or a safe place to leave the parcel.

tsx
import { Field, Textarea } from "@vjdesigns/vjdesigns-ui";

export function Accessibility() {
  return (
    <div style={{ width: "100%", maxWidth: "28rem" }}>
      <Field label="Delivery instructions" hint="Gate codes, or a safe place to leave the parcel.">
        <Textarea
          maxLength={120}
          showCount
          autoResize
          minRows={3}
          defaultValue="Leave it with the neighbor at number 12 if nobody answers."
          fullWidth
        />
      </Field>
    </div>
  );
}

Translated

The counter's announcement comes from the locale (French here). Your label and hint are your own text.

42 of 200 characters used

Décrivez votre demande en quelques lignes.

tsx
import { Field, Textarea, LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import fr from "@vjdesigns/vjdesigns-ui/locales/fr";

export function Translated() {
  return (
    <LocaleProvider locale="fr" messages={fr}>
      <div style={{ width: "100%", maxWidth: "28rem" }}>
        <Field label="Message" hint="Décrivez votre demande en quelques lignes.">
          <Textarea maxLength={200} showCount minRows={3} defaultValue="Bonjour, je souhaite modifier ma commande." fullWidth />
        </Field>
      </div>
    </LocaleProvider>
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Auto resize

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// AutoResize is the "Auto resize" example above.
<LocaleProvider locale="ar" messages={ar}>
  <AutoResize />
</LocaleProvider>

Usage notes

tsx
<label htmlFor="bio">Bio</label>
<Textarea id="bio" autoResize maxRows={8} maxLength={280} showCount />

API reference

Textarea

Textarea props
PropTypeDefault
size

Control size: scales font size and padding. Defaults to the surrounding Field's size, then md.

"sm""md""lg"—
variant

Visual style. filled uses a sunken background with a border that appears on hover and focus.

"outline""filled"—
radius

Corner rounding. Defaults to --field-radius.

"sm""md""lg""none""xs""xl""2xl"—
invalid

Marks the value invalid: sets aria-invalid and uses danger styling. Inherits from a surrounding Field.

boolean—
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string—
onValueChange

Called with the new value on every edit, controlled or not.

(value: string) => void—
rows

Visible number of text lines. With autoResize, this is the default for minRows.

number—
autoResize

Grow and shrink with the content between minRows and maxRows, then scroll. Uses CSS field-sizing: content where supported and measures scrollHeight otherwise. Forces resize="none".

boolean—
minRows

Minimum visible rows when autoResize is on. Defaults to rows.

number—
maxRows

Maximum visible rows when autoResize is on; beyond this the field scrolls. Unlimited when omitted.

number—
resize

Drag-resize handle direction. Defaults to vertical; always none with autoResize.

"none""vertical""both"—
showCount

Show an "n / max" character counter under the field. Requires maxLength. The counter is linked with aria-describedby; remaining characters are announced politely only once 90% of the limit is used.

boolean—
fullWidth

Stretch to the full inline size of the container.

boolean—
className

Class name for the wrapper element.

string—
textareaClassName

Class name for the <textarea> element itself.

string—
ref

Ref to the <textarea> element.

Ref<HTMLTextAreaElement>—

Also accepts native <textarea> attributes, plus className, style and ref.

See what changed in each version in the Changelog.

Accessibility report

Textarea targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

36 passed · 0 failed · 29 not applicable · 10 to check by hand

Dark mode

Score 100

36 passed · 0 failed · 29 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TabMoves focus into the text area.
TypingEdits the text, with the browser's usual caret and selection keys.

Roles and states

Roles and states
ElementRoleStates and properties
<textarea>textbox (multi-line)aria-invalid, aria-describedby → hint, error and counter
Character counternonearia-live="polite" near the limit

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)