HextaUI

Textarea: States

Disabled, read-only and invalid. Invalid textareas shake when a form submit fails.

import { Textarea } from "@/components/ui/textarea"

export function TextareaStates() {
  return (
    <div className="grid w-full max-w-md gap-4 sm:grid-cols-3">
      <Textarea
        aria-label="Disabled"
        disabled
        placeholder="Disabled"
        minRows={2}
      />
      <Textarea
        aria-label="Read-only"
        readOnly
        defaultValue="Read-only text you can select but not change."
        minRows={2}
      />
      <Textarea
        aria-label="Invalid"
        aria-invalid
        placeholder="Invalid"
        minRows={2}
      />
    </div>
  )
}

This adds the example as components/examples/textarea/states.tsx, together with the Textarea component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/textarea-states.json

To add only the component, follow the Textarea installation.

Props in this example

The Textarea props this example sets, from the API reference.

PropTypeDefault
minRows
number3

Every prop is in the Textarea API reference.

See them all, with keyboard support and accessibility notes, on the Textarea page.