NOCTA UI

Textarea

A versatile textarea component with multiple variants, sizes, resize options, and dark mode support

Installation

Install the Textarea component using the nocta-ui CLI:

Terminal
npx nocta-ui add textarea

Then import the component:

Import
import { Textarea } from '@/components/ui/textarea';

Basic Usage

Default Textarea

Textarea with Label

Textarea with Helper Text

Provide a detailed description of your project goals and requirements

Variants

The Textarea component supports three variants: default, error, and success.

Description is required

Description looks good!

Sizes

Three size options are available: sm, md, and lg. The default size is md.

Resize Options

Control how the textarea can be resized with the resize prop.

Resize is disabled

Can be resized vertically

Can be resized horizontally

Can be resized in both directions

Row Configuration

Adjust the initial height of the textarea using the rows prop.

Textarea States

Disabled State

This field is disabled

Read-only State

This field is read-only

Character Limit

Maximum 250 characters allowed

Customization

Custom Container

Custom container styling applied

API Reference

Props

PropTypeDefaultDescription
variant'default' | 'error' | 'success''default'Visual variant of the textarea
size'sm' | 'md' | 'lg''md'Size of the textarea
labelstringundefinedLabel text displayed above the textarea
helperTextstringundefinedHelper text displayed below the textarea
errorMessagestringundefinedError message (shown when variant is 'error')
resize'none' | 'vertical' | 'horizontal' | 'both''vertical'Resize behavior of the textarea
rowsnumber4Initial number of visible text lines
classNamestring''Additional CSS classes for the textarea element
containerClassNamestring''Additional CSS classes for the container

All standard HTML textarea attributes are also supported through props spreading.

Accessibility

  • Proper label association using htmlFor and id attributes
  • Support for aria-describedby when helper text is present
  • Focus management with visible focus indicators
  • Screen reader compatible error states
  • Keyboard navigation support