Search for a command to run...
Displays a form textarea or a component that looks like a textarea.
npx shadcn@latest add @zaidan/textareapnpx shadcn add @zaidan/textareayarn dlx shadcn@latest add @zaidan/textareabunx shadcn@latest add @zaidan/textareaCopy and paste the following code into your project.
1import { type ComponentProps, splitProps } from "solid-js";2
3import { cn } from "~/lib/utils";4
5type TextareaProps = ComponentProps<"textarea">;6
7const Textarea = (props: TextareaProps) => {8 const [local, others] = splitProps(props, ["class"]);9 return (10 <textarea11 data-slot="textarea"12 class={cn(13 "field-sizing-content z-textarea flex min-h-16 w-full outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",14 local.class,15 )}16 {...others}17 />18 );19};20
21export { Textarea, type TextareaProps };Here are the source code of all the examples from the preview page:
import { Textarea } from "~/components/ui/textarea";function TextareaBasic() { return ( <Example title="Basic"> <Textarea placeholder="Type your message here." /> </Example> );}import { Textarea } from "~/components/ui/textarea";function TextareaInvalid() { return ( <Example title="Invalid"> <Textarea placeholder="Type your message here." aria-invalid="true" /> </Example> );}import { Field, FieldLabel } from "~/components/ui/field";import { Textarea } from "~/components/ui/textarea";function TextareaWithLabel() { return ( <Example title="With Label"> <Field> <FieldLabel for="textarea-demo-message">Message</FieldLabel> <Textarea id="textarea-demo-message" placeholder="Type your message here." rows={6} /> </Field> </Example> );}import { Field, FieldDescription, FieldLabel } from "~/components/ui/field";import { Textarea } from "~/components/ui/textarea";function TextareaWithDescription() { return ( <Example title="With Description"> <Field> <FieldLabel for="textarea-demo-message-2">Message</FieldLabel> <Textarea id="textarea-demo-message-2" placeholder="Type your message here." rows={6} /> <FieldDescription>Type your message and press enter to send.</FieldDescription> </Field> </Example> );}import { Field, FieldLabel } from "~/components/ui/field";import { Textarea } from "~/components/ui/textarea";function TextareaDisabled() { return ( <Example title="Disabled"> <Field> <FieldLabel for="textarea-demo-disabled">Message</FieldLabel> <Textarea id="textarea-demo-disabled" placeholder="Type your message here." disabled /> </Field> </Example> );}