Textarea Component
A fully accessible textarea component built with native HTML elements and Tailwind CSS. Capture multi-line text input for forms, comments, and content creation with custom sizing, error states, and character count support. Theme-aware styling with label integration for accessible forms.
Textarea components capture multi-line text input from users, perfect for messages, comments, descriptions, and long-form content. Built with native HTML textarea elements and enhanced with Tailwind CSS styling, textareas support multiple sizes, colors, and states. Accessible and fully customizable, they integrate seamlessly into forms and communication interfaces.
| Class | Type | Description |
|---|---|---|
| textarea | Base | Styled multi-line text input |
| textarea-soft | Style | Muted tinted background |
| textarea-ghost | Style | No visible border until focused |
| textarea-dashed | Style | Dashed border style |
| textarea-xs | Size | Extra small |
| textarea-sm | Size | Small |
| textarea-md | Size | Medium (default) |
| textarea-lg | Size | Large |
| textarea-xl | Size | Extra large |
| textarea-2xl | Size | 2× extra large |
| textarea-primary | Color | Primary theme color border |
| textarea-secondary | Color | Secondary theme color border |
| textarea-accent | Color | Accent theme color border |
| textarea-neutral | Color | Neutral theme color border |
| textarea-info | Color | Info semantic color border |
| textarea-success | Color | Success semantic color border |
| textarea-warning | Color | Warning semantic color border |
| textarea-error | Color | Error semantic color border |
Basic Usage
<textarea class="textarea" placeholder="Enter your message here..."></textarea> |
<textarea className="textarea" placeholder="Enter your message here..."></textarea> |
Textarea Sizes
1 2 3 4 5 6 7 8 9 10 11 | <textarea class="textarea textarea-xs" placeholder="Extra Small"></textarea> <textarea class="textarea textarea-sm" placeholder="Small"></textarea> <textarea class="textarea textarea-md" placeholder="Medium"></textarea> <textarea class="textarea textarea-lg" placeholder="Large"></textarea> <textarea class="textarea textarea-xl" placeholder="Extra Large"></textarea> <textarea class="textarea textarea-2xl" placeholder="2X Large"></textarea> |
Textarea Colors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <textarea class="textarea" placeholder="Default"></textarea> <textarea class="textarea textarea-primary" placeholder="Primary"></textarea> <textarea class="textarea textarea-secondary" placeholder="Secondary"></textarea> <textarea class="textarea textarea-accent" placeholder="Accent"></textarea> <textarea class="textarea textarea-info" placeholder="Info"></textarea> <textarea class="textarea textarea-success" placeholder="Success"></textarea> <textarea class="textarea textarea-warning" placeholder="Warning"></textarea> <textarea class="textarea textarea-error" placeholder="Error"></textarea> |
Textarea Styles
1 2 3 4 5 6 7 | <textarea class="textarea" placeholder="Default style"></textarea> <textarea class="textarea textarea-soft" placeholder="Soft style"></textarea> <textarea class="textarea textarea-dashed" placeholder="Dashed style"></textarea> <textarea class="textarea textarea-ghost" placeholder="Ghost style"></textarea> |
Disabled Textarea
1 2 3 | <textarea class="textarea" placeholder="Enabled textarea"></textarea> <textarea class="textarea" placeholder="Disabled textarea" disabled></textarea> |
Textarea with Label
1 2 3 4 | <label> <span>Your feedback</span> <textarea class="textarea w-full" placeholder="Share your thoughts..."></textarea> </label> |
Textarea with Character Count
1 2 3 4 5 | <label> <span>Write a message (max 200 characters)</span> <textarea class="textarea w-full" placeholder="Type here..." maxlength="200"></textarea> <span>Characters remaining</span> </label> |
Advanced Markdown Editor
Use markdown-text-editor to turn any textarea into a full markdown editor.
Two modes are available: plain (raw Markdown syntax) and hybrid (renders formatting live as you type).
For more configuration options see the plugin docs.
Plain Mode
Displays raw Markdown syntax. Users write Markdown directly in the textarea.
<textarea id="plain-markdown-editor" name="content"></textarea> |
1 2 3 | import MarkdownEditor from "markdown-text-editor"; new MarkdownEditor('#plain-markdown-editor'); |
Hybrid Mode
Renders formatting live as you type — bold, headings, lists, and more appear styled inline.
<textarea id="hybrid-markdown-editor" name="content"></textarea> |
1 2 3 | import MarkdownEditor from "markdown-text-editor"; new MarkdownEditor('#hybrid-markdown-editor', { mode: 'hybrid' }); |