Textarea
Displays a form textarea or a component that looks like a textarea.
import { Textarea } from '@/components/ui/textarea';
<template><Textarea placeholder="Type your message here." /></template>Installation
Copy and paste the following code into your project.
import { cn } from '@/lib/utils';
import type { TOC } from '@ember/component/template-only';
export interface TextareaSignature {
Element: HTMLTextAreaElement;
Args: {
class?: string;
};
Blocks: {
default: [];
};
}
const Textarea: TOC<TextareaSignature> = <template>
<textarea
class={{cn
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"
@class
}}
data-slot="textarea"
...attributes
/>
</template>;
export { Textarea };
Update the import paths to match your project setup.
Usage
import { Textarea } from '@/components/ui/textarea';<Textarea />Examples
Default
import { Textarea } from '@/components/ui/textarea';
<template><Textarea placeholder="Type your message here." /></template>Disabled
import { Textarea } from '@/components/ui/textarea';
<template><Textarea disabled placeholder="Type your message here." /></template>With Label
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
<template>
<div class="grid w-full gap-3">
<Label @for="message">Your message</Label>
<Textarea id="message" placeholder="Type your message here." />
</div>
</template>With Text
Your message will be copied to the support team.
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
<template>
<div class="grid w-full gap-3">
<Label @for="message-2">Your Message</Label>
<Textarea id="message-2" placeholder="Type your message here." />
<p class="text-muted-foreground text-sm">
Your message will be copied to the support team.
</p>
</div>
</template>With Button
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
<template>
<div class="grid w-full gap-2">
<Textarea placeholder="Type your message here." />
<Button>Send message</Button>
</div>
</template>