Get Started
Migration
Components
- Accordion
- Alert Dialog
- Alert
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Formsnap
- Hover Card
- Input OTP
- Input
- Label
- Menubar
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Range Calendar
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Switch
- Table
- Tabs
- Textarea
- Toggle Group
- Toggle
- Tooltip
- Typography
Installation
Special sponsor
We're looking for one partner to be featured here.
Support the project and reach thousands of developers.
Reach out<script lang="ts">
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<Textarea placeholder="Type your message here." />
Installation
pnpm dlx shadcn-svelte@latest add textarea
npx shadcn-svelte@latest add textarea
bun x shadcn-svelte@latest add textarea
npx shadcn-svelte@latest add textarea
Copy and paste the component source files linked at the top of this page into your project.
Usage
<script lang="ts">
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<Textarea />
Examples
Default
<script lang="ts">
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<Textarea placeholder="Type your message here." />
Disabled
<script lang="ts">
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<Textarea disabled placeholder="Type your message here." />
With Label
<script lang="ts">
import { Label } from "$lib/components/ui/label/index.js";
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<div class="grid w-full gap-1.5">
<Label for="message">Your message</Label>
<Textarea placeholder="Type your message here." id="message" />
</div>
With Text
Your message will be copied to the support team.
<script lang="ts">
import { Label } from "$lib/components/ui/label/index.js";
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<div class="grid w-full gap-1.5">
<Label for="message-2">Your Message</Label>
<Textarea placeholder="Type your message here." id="message-2" />
<p class="text-muted-foreground text-sm">
Your message will be copied to the support team.
</p>
</div>
With Button
<script lang="ts">
import { Button } from "$lib/components/ui/button/index.js";
import { Textarea } from "$lib/components/ui/textarea/index.js";
</script>
<div class="grid w-full gap-2">
<Textarea placeholder="Type your message here." />
<Button>Send message</Button>
</div>
Form
<script lang="ts" module>
import { z } from "zod/v4";
const formSchema = z.object({
bio: z
.string()
.min(10, "Bio must be at least 10 characters.")
.max(160, "Bio must be at most 160 characters.")
});
</script>
<script lang="ts">
import { defaults, superForm } from "sveltekit-superforms";
import { zod4 } from "sveltekit-superforms/adapters";
import { toast } from "svelte-sonner";
import * as Form from "$lib/components/ui/form/index.js";
import { Textarea } from "$lib/components/ui/textarea/index.js";
const form = superForm(defaults(zod4(formSchema)), {
validators: zod4(formSchema),
SPA: true,
onUpdate: ({ form: f }) => {
if (f.valid) {
toast.success(`You submitted ${JSON.stringify(f.data, null, 2)}`);
} else {
toast.error("Please fix the errors in the form.");
}
}
});
const { form: formData, enhance } = form;
</script>
<form method="POST" class="w-2/3 space-y-6" use:enhance>
<Form.Field {form} name="bio">
<Form.Control>
{#snippet children({ props })}
<Form.Label>Bio</Form.Label>
<Textarea
{...props}
placeholder="Tell us a little bit about yourself"
class="resize-none"
bind:value={$formData.bio}
/>
<Form.Description>
You can <span>@mention</span> other users and organizations.
</Form.Description>
{/snippet}
</Form.Control>
<Form.FieldErrors />
</Form.Field>
<Form.Button>Submit</Form.Button>
</form>