Textarea

Alpha

An accessible multi-line text input with label, hint, error, and resize control.

Import

import { Textarea } from "@compa11y/react";

Usage

Example.tsx
import { Textarea } from "@compa11y/react";

function Example() {
  return (
    <Textarea
      label="Message"
      hint="Max 500 characters"
      rows={4}
      required
    />
  );
}

Features

  • Automatic label association
  • Hint and error text
  • Resize control
  • Compound component API
  • aria-invalid and aria-describedby for errors

Props

Textarea component props
PropTypeDefaultDescription
label*string-Label text
hintstring-Help text
errorstring-Error message
valuestring-Controlled value
onValueChange(value: string) => void-Called when value changes
rowsnumber3Number of visible rows
resize'none' | 'vertical' | 'horizontal' | 'both''vertical'Resize behavior
requiredbooleanfalseMarks as required
disabledbooleanfalseDisables the textarea

Keyboard Interactions

Accessibility
All keyboard interactions follow WAI-ARIA best practices and work without any additional configuration.
Keyboard shortcuts for Textarea
KeyAction
TabFocuses the textarea