ZaidanHomeDocsComponentsBlocksChartsTypesetCreate

Command Palette

Search for a command to run...

GitHub
New
Sections
  • Introduction
  • Components
  • Blocks
  • Installation
  • Customization
  • Dark Mode
  • Typeset
  • Zaidan Skills
  • FAQ
  • Roadmap
  • Changelog
Installation
  • Astro
  • Manual
  • Solid Start
  • TanStack Router
  • TanStack Start
  • Vite
Blocks
  • Data Grid
  • Event Calendar
  • Filters
  • Gantt
  • Image Crop
  • Kanban
  • Message Scroller
  • Questionnaire
  • Sortable
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • Native Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Radio Group
  • Resizable
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip

Textarea

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

1
import { Textarea } from "~/components/ui/textarea";
2
3
export default function TextareaDemo() {
4
return <Textarea placeholder="Type your message here." />;
5
}

Installation

pnpm dlx shadcn@latest add @zaidan/textarea
npx shadcn@latest add @zaidan/textarea
yarn dlx shadcn@latest add @zaidan/textarea
bunx --bun shadcn@latest add @zaidan/textarea

Usage

1
import { Textarea } from "~/components/ui/textarea";
1
<Textarea />

Field

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

Enter your message below.

1
import { Field, FieldDescription, FieldLabel } from "~/components/ui/field";
2
import { Textarea } from "~/components/ui/textarea";
3
4
export default function TextareaField() {
5
return (
6
<Field>
7
<FieldLabel for="textarea-message">Message</FieldLabel>
8
<FieldDescription>Enter your message below.</FieldDescription>
9
<Textarea id="textarea-message" placeholder="Type your message here." />
10
</Field>
11
);
12
}

Disabled

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

1
import { Field, FieldLabel } from "~/components/ui/field";
2
import { Textarea } from "~/components/ui/textarea";
3
4
export default function TextareaDisabled() {
5
return (
6
<Field data-disabled>
7
<FieldLabel for="textarea-disabled">Message</FieldLabel>
8
<Textarea id="textarea-disabled" placeholder="Type your message here." disabled />
9
</Field>
10
);
11
}

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.

Please enter a valid message.

1
import { Field, FieldDescription, FieldLabel } from "~/components/ui/field";
2
import { Textarea } from "~/components/ui/textarea";
3
4
export default function TextareaInvalid() {
5
return (
6
<Field data-invalid>
7
<FieldLabel for="textarea-invalid">Message</FieldLabel>
8
<Textarea id="textarea-invalid" placeholder="Type your message here." aria-invalid />
9
<FieldDescription>Please enter a valid message.</FieldDescription>
10
</Field>
11
);
12
}

Button

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

1
import { Button } from "~/components/ui/button";
2
import { Textarea } from "~/components/ui/textarea";
3
4
export default function TextareaButton() {
5
return (
6
<div class="grid w-full gap-2">
7
<Textarea placeholder="Type your message here." />
8
<Button>Send message</Button>
9
</div>
10
);
11
}

API Reference

Textarea is a styled native textarea element. See the HTML textarea element reference for its native props, keyboard behavior, and accessibility semantics.

On This Page

  • Installation
  • Usage
  • Field
  • Disabled
  • Invalid
  • Button
  • API Reference
Built by Kevin Abatan. The source code is available on GitHub.