Textarea
Displays a form textarea or a component that looks like a textarea.
Textarea is a native HTML <textarea> with shadcn styling, for multiline text (message, description, notes). Auto-resize is not included: use rows or CSS.
Installation
$ bext ui add textarea
Copy and paste the following into src/components/ui/textarea.tsx.
Usage
Anatomy
<Textarea id name placeholder rows disabled required />
API Reference
Textarea
| Prop | Type | Default | Description |
|---|---|---|---|
| placeholder | string | — | Hint shown while the field is empty. |
| id | string | — | id of the <textarea>, for a <Label htmlFor>. |
| name | string | — | Form field name. Forwarded to the <textarea> like any other attribute. |
| rows | number | — | Number of visible rows. Not set by default: the height comes from min-h-[60px]. |
| disabled | boolean | — | Disables the field (not-allowed cursor, 50% opacity). |
| required | boolean | — | Native required attribute. |
| className | string | — | Extra classes on the <textarea>. |
| …rest | attributes | — | Any other prop (aria-*, data-*, maxlength…) is forwarded to the <textarea>. There is no prop for initial text: the element is rendered empty. |
Keyboard
| Key | Action |
|---|---|
| Enter | Newline (unlike Input, which submits). |
Accessibility
Always pair it with a <Label htmlFor="id">. A placeholder is not a label.
Edit this example live in the bext playground. It compiles and runs entirely in your browser.
The React idiom: same UI, for comparison.
On This Page