Components

Textarea

Displays a form textarea or a component that looks like a textarea.

PreviewSource

Installation

Complete the project setup first. The init command configures TypeScript, Vite, Tailwind CSS v4, and Preact compatibility.

CLI

Run init once using the installation guide, then add this component. The CLI copies the required source files and installs their exact dependencies with Bun.

bunx --bun github:LiasCode/shadcn-preact#main add textarea

Add --dry-run to review the changes. Existing modified files are protected; use --overwrite only when you want to replace them.

Manual installation / degit (optional)

1. Install dependencies

bun add --exact cn@0.4.0 preact@11.0.1 tw-animate-css@1.4.0

2. Copy the component with degit

Run this from your project root. It selects textarea.tsx, its local dependencies, and both licenses directly from the repository, then copies them into src/components/ui.

bunx degit@3.10.0 https://github.com/LiasCode/shadcn-preact#main ./.cache/shadcn-preact/textarea --files LICENSE.md,registry/ui/lib/utils.ts,registry/ui/primitives/LICENSE,registry/ui/primitives/internals/types.ts,registry/ui/textarea.tsx --force
mkdir -p ./src/components/ui
cp -R ./.cache/shadcn-preact/textarea/registry/ui/. ./src/components/ui/
cp ./.cache/shadcn-preact/textarea/LICENSE.md ./src/components/ui/LICENSE.md

The temporary copy lives in .cache/shadcn-preact/textarea. Existing components stay in place; shared source files are updated from main.

Selected source files (4)

Usage

import { Textarea } from "./components/ui/textarea"
<Textarea />

Examples

Field

Use Field, FieldLabel, and FieldDescription to create a textarea with a label and description.

FieldSource

Enter your message below.

Example requirements

Also uses: Field.

Disabled

Use the disabled prop to disable the textarea. To style the disabled state, add the data-disabled attribute to the Field component.

DisabledSource
Example requirements

Also uses: Field.

Invalid

Use the aria-invalid prop to mark the textarea as invalid. To style the invalid state, add the data-invalid attribute to the Field component.

InvalidSource

Please enter a valid message.

Example requirements

Also uses: Field.

Button

Pair with Button to create a textarea with a submit button.

ButtonSource
Example requirements

Also uses: Button.

Reference

See the official Textarea documentation for composition patterns and API details. This page uses the Preact port and examples from the pinned upstream revision.

Component source