Introducing PrimeReact v11-alpha 🎉Discover Now

Textarea

Textarea is a multi-line text input element.

preview

Installation#

npx shadcn@latest add @primereact/ui/textarea

Usage#

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

Examples#

Basic#

basic-demo

Auto Resize#

Textarea can automatically adjust its height based on the content by setting the autoResize property.

auto-resize-demo

Filled#

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

filled-demo

Sizes#

Textarea provides small and large sizes as alternatives to the base by setting the size property.

sizes-demo

Invalid#

Invalid state is displayed using the invalid prop to indicate a failed validation. This style is useful when integrating with form validation libraries.

invalid-demo

Disabled#

When disabled is present, the element cannot be edited and focused.

disabled-demo

Accessibility#

Screen Reader#

Textarea renders a native textarea element. Provide an accessible name with a visible label, aria-label, or aria-labelledby.

Keyboard Support#

Textarea uses native textarea keyboard behavior.