import * as React from 'react'; import { cn } from '@/lib/utils'; import { Textarea } from './textarea'; import { Label } from './label'; /** * LabeledTextarea - 带 label 和 error 的 Textarea 包装组件 * 用于兼容现有表单(如 contact 表单)的 label/error API * 底层使用标准 shadcn/ui Textarea + Label */ export interface LabeledTextareaProps extends React.ComponentProps<'textarea'> { label?: React.ReactNode; error?: string; hint?: React.ReactNode; required?: boolean; } const LabeledTextarea = React.forwardRef( ({ label, error, hint, id, required, className, ...props }, ref) => { const generatedId = React.useId(); const textareaId = id || generatedId; const errorId = `${textareaId}-error`; const hintId = `${textareaId}-hint`; return (
{label && ( )}