Skip to Content
⭐️ Leave a star →
ComponentsTextarea

Textarea

Same compound API as Input, but renders a <textarea>. Controlled, uncontrolled, and consumer-controlled error state.

Features

Same compound API as Input (Label, Field, Error).
Consumer-controlled validation via invalidType.
Can be controlled or uncontrolled.
Supports all native textarea attributes.

Example

import { Textarea } from '@wire-ui/react' <Textarea.Root> <Textarea.Label>Message</Textarea.Label> <Textarea.Field placeholder="Type your message here..." rows={4} /> </Textarea.Root>

Styling

Textarea Field exposes the same data attributes as Input — data-active, data-invalid, and data-success.

<Textarea.Field className=" border border-black data-[active]:border-blue-500 data-[invalid]:border-red-500 " />

Using data attributes

Textarea.Field reflects focus and validation state through data attributes.

textarea[data-active] { border-color: #3b82f6; } textarea[data-invalid] { border-color: #ef4444; }

Root props

PropTypeDefaultDescription
valuestringControlled value
defaultValuestring''Initial value for uncontrolled use
onChange(value: string) => voidCalled on every keystroke
onFocus() => voidCalled on focus
onBlur() => voidCalled on blur
invalidTypestring''Key into errorMessage; consumer-controlled
errorMessageRecord<string, string>{}Map of error keys to display strings
isRequiredbooleanfalseShows * in label; sets aria-required
idstringauto-generatedLinks label to field

Field props

All standard <textarea> HTML attributes are supported on Textarea.Field (rows, cols, maxLength, etc.).

Field data attributes

AttributeWhen present
data-activeField is focused
data-invalidinvalidType is non-empty
Last updated on

MIT License © 2026 wire-ui

Textarea – Wire UI