Files
novalon-website/src/components/ui/textarea.tsx
T

35 lines
1.1 KiB
TypeScript

import * as React from 'react';
import { cn } from '@/lib/utils';
/**
* 标准 shadcn/ui Textarea 组件
* 遵循 shadcn/ui 规范:纯 textarea 元素 + data-slot + cn 工具
*
* 若需 label/error 属性,请使用 LabeledTextarea 组件
*/
const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<'textarea'>>(
({ className, ...props }, ref) => {
return (
<textarea
data-slot="textarea"
ref={ref}
className={cn(
'placeholder:text-text-placeholder selection:bg-brand selection:text-white',
'flex min-h-[80px] w-full rounded-md border border-border-primary bg-bg-primary px-3 py-2 text-base',
'transition-all duration-fast outline-none',
'disabled:cursor-not-allowed disabled:opacity-50',
'md:text-sm',
'focus-visible:border-brand focus-visible:ring-2 focus-visible:ring-brand/30',
'hover:border-border-secondary',
'touch-manipulation resize-y',
className
)}
{...props}
/>
);
}
);
Textarea.displayName = 'Textarea';
export { Textarea };