Unkey
Components

FormTextarea

A form textarea component with built-in label, description, and error handling capabilities.

FormTextarea

A comprehensive multi-line text input component that combines labels, descriptions, and validation states. Perfect for creating accessible, user-friendly forms that require longer text inputs with proper labeling and helpful context.

Default

The default FormTextarea includes a label and optional description text, providing clear context for users.

Provide a detailed description of your project

Textarea States

Required Field

Use the required prop to indicate mandatory fields. This automatically adds a "Required" tag to the label.

Share your thoughts with the council

Required Field with Error

When a required field has an error, the "Required" tag changes to error styling to draw more attention.

Optional Field

Use the optional prop to explicitly indicate non-mandatory fields. This adds an "Optional" badge to the label.

Any other information you'd like to share

Success State

Indicates successful validation or acceptance of input value. The success icon and text provide positive feedback.

Your public key has been verified

Warning State

Used for potentially problematic inputs that don't prevent form submission. Includes a warning icon and explanatory text.

This content will be visible to all team members

Error State

Shows validation errors or other issues that need user attention. Features prominent error styling and message.

Disabled State

Apply when the field should be non-interactive, such as during form submission or based on other field values.

Cannot be modified by regular users

With Default Value

Pre-populated textarea with an initial value that users can modify.

Notes from the Council of Elrond

Read-only State

For displaying non-editable information while maintaining form layout consistency.

Copy this log for troubleshooting

Complex Usage

Example of a FormTextarea with multiple props configured for a specific use case.

Enter the JSON payload template for your webhook

Props

The FormTextarea component extends the standard Textarea component props with additional form-specific properties:

PropTypeDefault
variant
"default" | "success" | "warning" | "error"
-
leftIcon
ReactNode
-
rightIcon
ReactNode
-
wrapperClassName
string
-
label
string
-
description
ReactNode
-
required
boolean
-
optional
boolean
-
error
string
-

Accessibility

FormTextarea is built with accessibility in mind:

  • Labels are properly associated with textareas using htmlFor/id
  • Error messages are announced to screen readers using role="alert"
  • Required fields are marked both visually and via aria-required
  • Helper text is linked to textareas using aria-describedby
  • Error states are indicated using aria-invalid

Best Practices

When using the FormTextarea component:

  • Always provide clear, concise labels
  • Use description text to provide additional context when needed
  • Keep error messages specific and actionable
  • Use required fields sparingly and logically
  • Group related form elements using fieldset and legend when appropriate
  • Consider the mobile experience when writing labels and descriptions
  • Maintain consistent validation patterns across your form
  • Consider character/word limits for lengthy inputs
  • Use the rows attribute to set an appropriate initial height
  • Test with screen readers to ensure accessibility

Layout Guidelines

  • Labels should be clear and concise
  • Error messages should appear immediately below the textarea
  • Description text should be helpful but not too lengthy
  • Consider using the optional badge for clarity in forms with many fields

On this page