Components
import { Textarea } from "@/components/ui/textarea"
export function TextareaDemo() {安装
pnpm dlx shadcn@latest add textarea
用法
import { Textarea } from "@/components/ui/textarea"<Textarea />示例
字段
使用 Field、FieldLabel 和 FieldDescription 创建带标签和描述的多行文本框。
Enter your message below.
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Textarea } from "@/components/ui/textarea"
禁用
使用 disabled 属性禁用多行文本框。要为禁用状态添加样式,请在 Field 组件上添加 data-disabled 属性。
import { Field, FieldLabel } from "@/components/ui/field"
import { Textarea } from "@/components/ui/textarea"
无效
使用 aria-invalid 属性标记多行文本框为无效。要为无效状态添加样式,请在 Field 组件上添加 data-invalid 属性。
Please enter a valid message.
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { Textarea } from "@/components/ui/textarea"
按钮
与 Button 搭配使用,创建带提交按钮的多行文本框。
import { Button } from "@/components/ui/button"
import { Textarea } from "@/components/ui/textarea"